In your tsconfig.json [0]:
"moduleResolution": "node16"
In your TS files, even if the import is a file with the extension .ts (tsc will handle): import { test } from './importMe.js';
[0]: https://www.typescriptlang.org/tsconfig#moduleResolutionRight, this is what people are arguing about in the issue.
It’s honestly extraordinarily unintuitive and frustrating, and the team’s arguments are more philosophical than practical (along the lines of “typescript will never deviate from JavaScript language specification”). I’m not very sympathetic since the entire language is incompatible with a JS interpreter, and importing from a file that doesn’t actually exist is really poor DevX.
I really wish the TS team had not forced people to decide between ESM (the future of JS modules) or importing files that don’t actually exist everywhere in the codebase.
> entire language is incompatible with a JS interpreter
If this proposal will ever be accepted, TS will be (in large parts) valid JS: https://github.com/tc39/proposal-type-annotations