tsconfig.json:
{
"extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/node24/tsconfig.json"],
"include": ["**/*"],
"exclude": ["node_modules", "**/dist"]
}
package.json has "type": "module".
import {Foo} from './Foo' gives me an error:
Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.js'?
ts(2835)
import {Foo} from './Foo.ts' also gives me an error:
An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled
.ts(5097)
Adding these options to the tsconfig makes it work:
"compilerOptions": {
"allowImportingTsExtensions": true,
"noEmit": true
}
but it shouldn't be necessary to modify the config to get it working.
tsconfig.json:
{ "extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/node24/tsconfig.json"], "include": ["**/*"], "exclude": ["node_modules", "**/dist"] }package.json has
"type": "module".import {Foo} from './Foo'gives me an error:import {Foo} from './Foo.ts'also gives me an error:Adding these options to the
tsconfigmakes it work:but it shouldn't be necessary to modify the config to get it working.