[Feature Request] Add compilerOption that validates ".js" extension is present in import path #52204
Closed
5 tasks done
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Suggestion
Previously, the TypeScript team have made it clear that the compiler will not modify/rewrite import path extensions to convert TypeScript imports to valid ESModule imports - that's totally fine, this is not that discussion
Currently, the TypeScript compiler does accept import paths to TypeScript source files with
.js
extensions. Despite the import saying.js
it will resolve the relevant.ts
file:Can the TypeScript compiler include the capacity to enforce that extensions are present - (only a suggestion) perhaps via a new
moduleResolution
which respects the ES Module standard?Perhaps:
Where, when enabled:
Pros:
Cons:
🔍 Search Terms
enforce typescript .js extension in import path
✅ Viability Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: