TestyTs icon indicating copy to clipboard operation
TestyTs copied to clipboard

Support for .js files without internal TypeScript compilation

Open JannesMeyer opened this issue 3 years ago • 5 comments

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 avatar Oct 29 '20 08:10 JannesMeyer

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: https://github.com/TypeStrong/ts-node/issues/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 avatar Oct 29 '20 09:10 JannesMeyer

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.

JannesMeyer avatar Oct 29 '20 09:10 JannesMeyer

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 avatar Nov 17 '20 00:11 Aboisier

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 avatar Dec 14 '20 02:12 Aboisier

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!

Aboisier avatar Oct 09 '21 20:10 Aboisier