Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for .js files without internal TypeScript compilation #55

Open
JannesMeyer opened this issue Oct 29, 2020 · 5 comments
Open

Support for .js files without internal TypeScript compilation #55

JannesMeyer opened this issue Oct 29, 2020 · 5 comments

Comments

@JannesMeyer
Copy link

Hi,

I'm currently using a beta feature from TypeScript 4.1 beta, which has a new flag in tsconfig.json called noUncheckedIndexedAccess.

ts-node doesn't understand this yet, which is evident when I try to run testyts:

Error: "⨯ Unable to compile TypeScript:
error TS5023: Unknown compiler option 'noUncheckedIndexedAccess'."

Is it possible to use an external tsc --watch process and just point testyts at the compiled .js files?

@JannesMeyer
Copy link
Author

JannesMeyer commented Oct 29, 2020

Being able to do this would help with another issue that I'm having with ts-node.

I'm including .js at the end of the filenames in my import/require statements. ts-node does not understand this neither. It complains that it cannot find the file. However, adding .js at the end of filenames is the only way to do it if you use native ES modules (without bundling) in the browser. Browsers are not in a situation where they can magically append various file extensions and make GET requests until they find the correct file name.

Here's the ts-node issue on the topic: TypeStrong/ts-node#783 They closed the issue saying that Microsoft has to implement a workaround in TypeScript. However, Microsoft has indicated that they don't want to rewrite import paths. Thus resulting in a stalemate.

In summary, ts-node is off-limits for me due to a variety of unsupported features.

@JannesMeyer JannesMeyer changed the title Support for .js files without TypeScript compilation Support for .js files without internal TypeScript compilation Oct 29, 2020
@JannesMeyer
Copy link
Author

Another issue I noticed is that TestyTS currently seems to force TypeScript 3.9 for ts-node compilation, even though the stable version of 4.0 has been released already.

Being able to compile TypeScript files externally should probably resolve this as well.

@Aboisier
Copy link
Collaborator

Hi! I somehow didn't get notified you created an issue! I'll take a clsoe look at this as soon as possible. If you would like to make a pull request and fix this, that would also be welcome!

@Aboisier
Copy link
Collaborator

Hello! Just a quick update: I haven't had time to take a look at this in particular because I've been working on setting up integration tests. Now that that's done, I should be able to make a repro and fix this.

@Aboisier
Copy link
Collaborator

Aboisier commented Oct 9, 2021

Hi,

The latest beta version of TestyTs, 2.0.0-beta.5, now comes with the latest version of ts-node. This should fix the noUncheckedIndexedAccess issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants