If I really needed to use a JS library in TS, I’d have to build some sort of adapter between the two that crashes whenever the JS library (that doesn’t know anything about your types) breaks the typing rules. Anything else will inevitably lead to the above “fun” kind of bugs.
I don’t think that this would work, there are no types anymore during runtime because everything is translated into plain js on build. TypeScript only exists during development
Yes. As of this writing there are 7,738 type definitions in a central repo maintained by users for plain JavaScript packages.
https://github.com/DefinitelyTyped/DefinitelyTyped
Many package owners write type definitions included with their package that is written in JavaScript also.
Web dev continues to be cursed, I guess.
If I really needed to use a JS library in TS, I’d have to build some sort of adapter between the two that crashes whenever the JS library (that doesn’t know anything about your types) breaks the typing rules. Anything else will inevitably lead to the above “fun” kind of bugs.
I don’t think that this would work, there are no types anymore during runtime because everything is translated into plain js on build. TypeScript only exists during development