3 ms·
Is it not a problem in practice when TS type declarations and their associated JS code are written by different people at different times for different versions
by fauigerzigerk 9y ago
Is it not a problem in practice when TS type declarations and their associated JS code are written by different people at different times for different versions of a library?
I have no experience with maintaining TS projects over a longer period of time, but I have started some experimental TS projects where I was looking for type declarations.
What I found didn't seem to have any formal reference to a specific version of the library. I found that a bit scary. Not sure if it actually causes problems though.
- deleted 9y ago[deleted]
- mattmanser 9y agoNot caused us any yet over 3 years. You've got to think of it as the opposite, when we find a missing method because we at some point updated a library, we update the ts definition. So it's not that it's a source of errors as most libraries are backwards compatible.
- geon 9y ago> Is it not a problem in practice when TS type declarations and their associated JS code are written by different people at different times for different versions of a library? It can be. But most popular libraries have very good version syncing, or even include definitions in the module itself. In the worst case, or if there are no typings available at all, you can just import the plain js, and use it untyped, which can be acceptable if it is not used in a lot of places. > didn't seem to have any formal reference to a specific version Yeah. It mostly works if you install the latest version of them both at the same time. Sometimes I've had to fiddle with backing the definition or the module back a version to get them to match.