You get the type safety and autocompletion without using another language or changing the build pipeline with JSDocs. I really don't understand the hype for Typescript.
that some editors understand well enough to support code completion (which probably is the greatest factor of the "TypeScript in VS Code" popularity).
Preact's code base is written in JavaScript but it also provides TypeScript types in declaration files (e.g. internal.d.ts) which are then referenced in the JavaScript implementation files via JSDoc (e.g. create-element.js).
This means that the JavaScript doesn't have to be transpiled but can be type-checked (type-linted?) on demand with the TypeScript tooling.
The downside is that you have to be pretty good with TypeScript types to author the declaration files; meanwhile most developers aren't willing to leave the comfort of plain "TypeScript in VS Code" behind once they've grown accustomed to it.
Totally agree. TypeScript is okay. It's a tool, it has it's purposes. It's not an "improvement" or "fix" for JavaScript. Only people who have never bothered to learn JavaScript think like that.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You get the type safety and autocompletion without using another language or changing the build pipeline with JSDocs. I really don't understand the hype for Typescript.
There is no type safety with plain JSDoc. It's
"An API documentation generator for JavaScript."
that some editors understand well enough to support code completion (which probably is the greatest factor of the "TypeScript in VS Code" popularity).
Preact's code base is written in JavaScript but it also provides TypeScript types in declaration files (e.g. internal.d.ts) which are then referenced in the JavaScript implementation files via JSDoc (e.g. create-element.js).
This means that the JavaScript doesn't have to be transpiled but can be type-checked (type-linted?) on demand with the TypeScript tooling.
The downside is that you have to be pretty good with TypeScript types to author the declaration files; meanwhile most developers aren't willing to leave the comfort of plain "TypeScript in VS Code" behind once they've grown accustomed to it.
Totally agree. TypeScript is okay. It's a tool, it has it's purposes. It's not an "improvement" or "fix" for JavaScript. Only people who have never bothered to learn JavaScript think like that.