Comment by eropple
3 years ago
The projects that are using JSDoc for typings are doing so because they are way, way out on the edge in ways that stress Typescript compilers. They're doing weird stuff. It isn't a recommended path unless you absolutely need it; it's sacrificing a lot in order to yield faster round-trip time on codebases that have no other option.
Typescript isn't really "a new language", either. It's a pretty mild superset.
> because they are way, way out on the edge in ways that stress Typescript compilers
I don't think this is true at all. Probably the main reason people typecheck js with jsdoc annotations is because they don't want a TS compile step.
Nodejs ES modules, and typescript, make it more complicated that it needs to be to write JS specifically for nodejs/cli scripts (not bundling to run in the browser). I now just prefer to // @ts-check my js files when writing node scripts.
> Probably the main reason people typecheck js with jsdoc annotations is because they don't want a TS compile step.
Right, I agree--because it's slow. Like AFAIK the tooling roundtrip is why Svelte/SvelteKit made the change. For normal projects, you don't have that same problem.
> for nodejs/cli scripts
I just use ts-node with the ESM loader. It's drop-in, for my purposes at least. What problems are you seeing?