Right, 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.
I think it's the right solution, though I get that it confuses people.
Given that the compiler only erases static type annotations, it should not touch the imports.
> entire language is incompatible with a JS interpreter
Didn’t they add a new option `allowImportingTsExtensions` to TypeScript 5 that allows you to use `.ts` in imports? I haven’t tried it but that’s what I understood from the blog article
This reminds me again of the whole mess with `paths` and the TS team refusing to do the bare minimum to make TS->JS compilation work with that feature instead of needing to rely on outside tooling.
This had driven me nuts recently.
One of the dependencies was converted to ESM. If I want to import it I must convert my project to ESM (or use dynamic import that is hell of its own). That would not be very painful exept for the need to rewrite everyimportstatement in the project.
I guess TS5 with moduleResolution bundler solves that? Did not have time to try that yet.
It’s disgraceful how little respect github commenters have for maintainers sometimes. They seem so entitled to having the package work the way they want it to when it’s used by millions of developers. I feel that the typescript maintainers were incredibly polite here and should have locked the issue much earlier.
Open source developers at big companies are often incredibly competent as well as under supported compared with those that work on products that bring in revenue. We don’t also have to emotionally attack them.
Except Typescript maintainers were arrogant and locking issues for 6 years (as far as I have seen). It's pretty simple to satisfy the millions of developers, just don't suggest stupid workaround and follow the standard.
This same script was replicated to near every repository I have worked on, including making its way into a few different production services where Node.js + ESM was used for deployment
Eventually I had turned into a utility module that could be used wider, which starts to lean into import map generation
14 comments
[ 3.4 ms ] story [ 42.5 ms ] threadIt’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
[0] https://devblogs.microsoft.com/typescript/announcing-typescr...
It touches on exactly this topic in the timestamp in the link.
[0]: https://youtu.be/MEl2R7mEAP8?t=2360
Open source developers at big companies are often incredibly competent as well as under supported compared with those that work on products that bring in revenue. We don’t also have to emotionally attack them.
https://github.com/virtualstate/promise/blob/main/scripts/co...
https://github.com/virtualstate/focus/blob/main/scripts/corr...
https://github.com/virtualstate/navigation/blob/main/scripts...
This same script was replicated to near every repository I have worked on, including making its way into a few different production services where Node.js + ESM was used for deployment
Eventually I had turned into a utility module that could be used wider, which starts to lean into import map generation
https://github.com/virtualstate/impack#usage
You can see it being used here as a function, but can be used as a cli tool too:
https://github.com/virtualstate/listen/blob/033bf8effcbde5c8...