-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use js extensions instead of ts in imports #1374
Conversation
bf5c115
to
c2c7dc7
Compare
This pull request is automatically being deployed by Amplify Hosting (learn more). |
@@ -3,8 +3,6 @@ | |||
"target": "ESNext", | |||
"module": "ESNext", | |||
"moduleResolution": "Bundler", | |||
// Allow importing TypeScript files using their native extension (.ts(x)). | |||
"allowImportingTsExtensions": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In latest typescript this only works with emitDeclarationOnly (we could also just set that to true), but imo this flag is kinda tech debt anyways because it relies on bundler tool to resolve the import paths, and we actually want to stay bundleless.
This closes #1371 🥂 |
Issue #, if available:
closes #1371
Description of changes:
Generally speaking TypeScript expects .js extensions for imports because the compiled output is .js. In the future TS might release a new feature allowing .ts extensions, but currently under NodeNext moduleResolution, .js is the way to go for files that actually compile to JS.
That said, in JSDocs annotated type-only imports we should use .d.ts extension because we only emit declaration files for these, so the compiled output is just .d.ts files.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.