The creator of uhtml/usignal https://twitter.com/WebReflection/status/1272276063222222852
The creator of Svelte (not go all-in) https://twitter.com/Rich_Harris/status/1350436286948122625
And many others experienced devs I didn't collect evidence that it's hard to dig later.
Mostly they do just because folks on github demand support, to satisfy audience.
The creator of uhtml believes there are transpilation bugs. I can't say whether this is true, but if it's an issue for them, I guess that's a valid reason.
Jason Miller's tweet also includes a common reason: he isn't good at it and doesn't understand it, or in his words "the amount of time I have to spend screwing up my already-working code to make TypeScript happy". This is a big one. TypeScript is hard, and poorly written TypeScript increases complexity. My last job was a TS codebase written by people who didn't understand it and it was a major impediment to productivity.
The Rich Harris tweet represents a common misunderstanding about TypeScript types. If your types can be represented by primitives like `string` or `number`, then his JSDoc approach is fine, but when writing TS those sorts of primitives are barely scratching the surface. For example, TS has a powerful Generics syntax that cannot be duplicated in a code comment.
TypeScript is very complex because it needs to be able to type all valid JS code, which means being able to describe things that most other languages would never even allow. JavaScript is very flexible and permissive, and all of us are used to working with them in a way that's hard to type. One of the first steps in learning TS is to change the way you write code to make it easier to type. You have to make decisions earlier in the process, and yes, there is usually more time spent writing code initially, but if done well, you can screen out a lot of bugs.
IMO these devs have the luxury of not using TS because they can expect the community to provide the types for them.
2. Harder to grok code (spaghetti)
3. I don’t want to give Microsoft any more leverage over the development ecosystem
4. TS will likely go the way of CoffeeScript eventually
5. TS is massively complex because of the difficulty of typing JS, I’d much rather use a language designed from the start as a strongly typed language.
6. The types are removed after compilation, so they’re only helpful during development.
However, I do like to add JSDoc types and run the Typescript compiler to check things and generate types for TS users.
I think somthing similar may happen to TS.
Essentially, TS feels like training wheels for small codebases and red tape for large codebases. I do feel it helps for large codebases where someone might not be familiar with everything but reading the code works way better than types. If someone can not understand the code then that means: 1) it is not documented correctly, 2) the person needs more instruction/tutelage, 3) it is probably incorrectly implemented or 4) something more clever.
2. Use a modern target, my transpiled code is 1:1.
3. You can use JSDoc type annotations, I use this for some projects.
4. TS works well in functional code bases. If you prefer JavaScript's dynamics, expect pain.
5. You can also use Flow.
6. Your sample size is 3
[SvelteKit] (official Svelte framework) uses TypeScript quite a bit.
First, the internal code was ported to TypeScript, then DX for TypeScript was added. The official template supports JSDoc TS (default), TypeScript, or no typing.
I think another community member added TS support, and Rich said he couldn't have done it by himself. (Or maybe that was regarding the VS Code TS support tooling.)
[SvelteKit]: https://kit.svelte.dev/
There are specific reasons depending on the project context.