|
|
|
|
|
by danShumway
2288 days ago
|
|
> If that is your problem, why don't you just avoid importing typings for libraries? Yes? That's exactly what people are doing when they import a dependency written in Typescript into a pure JS project. > A whole lot of the time, especially in Javascript land you will join projects where libraries are being used, and where documentation is lacking. Your advice here is basically to not be part of those projects? Instead of developing and using tooling that will ensure that these situations no longer happen? My claim is that Typescript does not solve the problem of joining a project with poorly written, undocumented libraries. I'm not bashing on Typescript. If the primary way you use it is as an organizational tool to reduce cognitive load and make interfaces more explicit, then that's great. You're using Typescript as intended. And there are some scenarios where a compile-time type-checker is just obviously the right tool for the job. You started this thread by asking how JS devs could manage 3rd-party interfaces without Typescript. I assume you genuinely want an answer to that question. The answer is that for some people on some projects, using well defined interfaces and keeping a reference page open with documentation is about as fast and about as easy as using Typescript, and that following that process doesn't increase their bug count or cognitive load to the point where they feel the need to introduce a compilation step. |
|
Except that in this way they also lose good typings for any other library and for their own code as well. I understand an outdated definition file can be annoying, but there can be various ways to only ignore type definitions for that specific library.
> My claim is that Typescript does not solve the problem of joining a project with poorly written, undocumented libraries.
That is a problem that no language or tool can solve.
> You started this thread by asking how JS devs could manage 3rd-party interfaces without Typescript.
No, I didn't, you're confusing me with someone else. Inertiatic asked at the beginning of this thread
"Who are these mythical people? [the developers who never make typings mistakes] Do they just magically decipher what interface an argument conforms to? What methods are accessible on a returned result from any random library they're using?"
Then the thread proceeded by 1) ignoring the first part of his question, about having to remember signatures in general, including of your own code; 2) interpreted "random" in a strictly negative way, as if it meant "any junk library" instead of "every library".