Consider `allowImportingTsExtensions`
https://www.typescriptlang.org/tsconfig/#allowImportingTsExtensions
Required for:
import {addTests} from './collector.ts';
Which is required by node --experimental-strip-types
This is unrelated/unaffected by #29
I don't know what are the consequences of allowing .ts imports though. Also XO currently enforces .js extensions:
require file extension '.js'. (n/file-extension-in-import) XO
Enabling allowImportingTsExtensions means that it's easy for users to make the mistake of using .ts instead of .js. I think this will cause a lot of problems. I'm not sure it makes sense to introduce this pitfall just to enable the user of a highly experimental Node.js feature. It seems like for now, you should just manually enable that in the projects tsconfig. In addition, it's also unclear whether it has any other hidden gotchas.
experimental Node.js feature
Yeah we'll definitely have to wait and see if it's worth it.
whether it has any other hidden gotchas
It is a tricky situation.
- Node has to look for the .ts file because it's reading a .ts file source;
- packages have to look for a .js file because they have .js entry points.
My guess is that allowImportingTsExtensions exclusively makes sense for projects/applications, and not for modules that are meant to be distributed.
I think Node is the only tool that requires this, and it's experimental.
Type stripping is no longer experimental and it's enabled by default in node since 22.18. Example:
- https://github.com/nodejs/node/issues/59364