-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Milestone
Description
π Search Terms
"auto imports", "allowImportingTsExtensions", "package.json imports", ".js extension instead of .ts", "moduleResolution": "NodeNext"
π Version & Regression Information
TypeScript v5.5.4
β― Playground Link
No response
π» Code
tsconfig.json:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true
}
}package.json:
{
"type": "module",
"imports": {
"#*": "./src/*"
}
}src/lib/add.ts (not really important, the content of the file, path is more important):
export const add = (a: number, b: number): number => {
return a + b
}src/index.ts:
import { add } from "#lib/add.js" // WRONG AUTO IMPORT, using .js, instead of .ts
console.log(add(2, 3))π Actual behavior
Auto import with #lib/add.js"
π Expected behavior
Auto import with #lib/add.ts" because I'm using the "allowImportingTsExtensions": true config option.
This is all the more relevant since the newly added CLI Flag --experimental-strip-types in Node.js, because it enforces imports to use the .ts extension.
Ref: https://nodejs.org/docs/latest/api/typescript.html
Additional information about the issue
Related issue: #52167
trompx
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.