6 ms·
Typescript is the JS life-saver.
by revskill 3y ago
Typescript is the JS life-saver.
- shepherdjerred 3y agoTypeScript doesn't solve any of the issues mentioned in the article
- revskill 3y agoIt just solved the "untyped" problem, and it's more than enough.
- shepherdjerred 3y agoYes! TypeScript is fantastic, but you still do need the pain of the JavaScript ecosystem to do much with it.
- vbezhenar 3y agoAnd adds its own layer of weirdness. Just one simple example: you must write `import { name } from "./file.js"`. Not `"./file.ts"`. Why js? Because TypeScript developers are stubborn that their thing is just a layer on top of JS so they refuse to change ".ts" to ".js" in the generated output. This is just wrong approach. But here we are, importing things from "./file.js" which doesn't even exist.
- leshenka 3y agoif `import { name } from "./file"` doesn't work for you, something's up with your setup
- shepherdjerred 3y agoI don't know the details, but I think there's some new-sh flag or something in TypeScript that requires the `.js` extension. I don't know if they're pushing that to be the default or what.
- vbezhenar 3y agoIf you use ESM modules, they won't resolve files without extensions.
- shepherdjerred 3y agoAh! That must be it. Yeah, super weird that you _have_ to put `.js` when that only exists at runtime