4 ms·
Get deeper into the type system and avoid classes. There's still some fun to be had. But yes: TS can not fully capture what JS is capable of.
by Garlef 6y ago
Get deeper into the type system and avoid classes. There's still some fun to be had.
But yes: TS can not fully capture what JS is capable of.
- oakesm9 6y agoTypescript is a superset of JavaScript. Valid JavaScript is also valid Typescript. Therefore anything that you can do in JavaScript is also possible in Typescript. You might annoy the type checker, but if you're certain that you know better then there's always ways to disable those errors.
- haolez 6y agoOf course, but that's not why you'd choose TypeScript in the first place.
- afavour 6y agoTo be pedantic: strict TypeScript cannot fully capture what JS is capable of. And, I'd argue, non-strict TypeScript kind of ruins the reason to use TS in the first place.
- domano 6y agoIDE support with JS is sometimes so advanced, that just changing the filename to TS makes the support worse, without any code change. This only goes for some special cases and sadly react-redux with rematch is one of them. Typescript can not understand which types are present in my dispatch object, whereas it is possible with JS autocompletion! Just wanted to bring up this rather curious exception to the rule.
- dragonwriter 6y ago> IDE support with JS is sometimes so advanced, that just changing the filename to TS makes the support worse, without any code change. That’s kind of dumb on the part of the IDE involved.
- Tade0 6y ago> Valid JavaScript is also valid Typescript. Unfortunately, no: https://github.com/microsoft/TypeScript/issues/1863 https://github.com/microsoft/TypeScript/issues/1863