Having spent the last two years back in JavaScript, and in the process of moving a >10y project to TS as a part of a larger refactor,
emphatically yes it’s been worth it. I have been hanging on to tsserver to bridge the gap for two years, and well… it’s night and day.
I can add ~95% of the same safeguards without it, but I’ll spend a lot more time doing so and it’s a lot harder to get buy in to make them stricter than my own editor.
> For example, a new package you install can require a new TypesScript version. Once installed, you then may need to update your source code. This can place quite a high tax on the developer, where perhaps a 10 minute change becomes hours long.
If your project is already strict and if you generally have a good sense of the areas TS doesn’t cover, you probably wouldn’t need to update anything for the last couple years. If your project isn’t strict, you’re probably benefitting from updates more closely matching the semantics you wanted in the first place.
> Most libraries do not document their types, or have no examples using TypeScript. Some worst offenders: Apollo, Protobufjs. The type definitions exported by these libraries can be large and complex, and the error messages emitted by TypeScript are so long and cryptic the result is often a drawn out process of trial and error along with trawling through source files.
It’s fairly trivial to add local type defs if you’re at all interested in the type safety it brings. They’re almost universally easy to transfer to PRs for DefinitelyTyped (which admittedly I should do more often, and I should open a few after I land this work in my project).
> Errors are long and don't provide enough detail. They will explain a type mismatch referencing many types you may not have ever seen, and are not documented anywhere. Except for simple errors, many of them are very hard to follow to a remedy.
This is true. You’re right. If you want a little helpful pointer:
type Debug = [AnyType] extends [never]
? 'My understanding of AnyType failing'
: AnyType
Edit: this ^ was typed on my phone from recall and I’m tired and might not be quite right. I’m happy to revise it tomorrow if that’s the case.
It’s not great but it’s basically a very slow way to walk up the type resolution stack until you find what doesn’t behave the way you expect.
> Transpilation takes time, and always adds a burden to developers. I didn't mind so much with ES6 etc because eventually many functions were included in a broad set of browsers. There doesn't seem to be much progress including TypeScript in a browser, and feels like these complicated transpilation steps could be with us for a long time.
ESBuild, Vite, SWC and such have basically made the build step instantaneous. They’re not without config woes, but they’re worlds better than what came before. So much so I will volunteer to help you set up a project’s build if you do the very easy legwork to find any number of ways to contact me.