3 ms·
Good point. That being said, TS does suffer from something unique, in its JS interop. If my C program interfaces with a C library, I have great certainty that
by 013a 9y ago
Good point.
That being said, TS does suffer from something unique, in its JS interop. If my C program interfaces with a C library, I have great certainty that all of these were compiled at some point, and the types are sound (as much as C allows, at least).
In TS, if you're lucky a library you consume was written in TS, so you've got high certainty that the typings it comes with are really good. Less lucky: the developer wrote it in JS, but provides typings. Less lucky: a random person on Github reverse-engineered the typings and provided them on DefinitelyTyped. Less lucky: There are no typings available. You'll run into npm libraries in all of these categories.
- barakm 9y agoGood to know; if this were a stated reservation, that'd be worth writing about.
- fny 9y agoEven less lucky: coding in vanilla JavaScript. In the days before Definitely Typed, I still got a lot of mileage out of types in my code alone. It felt immensely more apt then using JSDoc to document types everywhere. In my experience, even if you don't have types for a third-party library, you can get away with adding types for the interfaces you care about.