This is actually not true. There are too many pure JavaScript projects with or without JSDoc (and sometimes TypeScript IntelliSense just doesn't read JSDoc...) That's why github.com/DefinitelyTyped/Definit... exists, which are actually hand-written *.d.ts's.
(Though, I know it is possible to generate *.d.ts from JSDoc. I do that sometimes.)
You can also add *.d.ts to a pure JavaScript project of someone else, without submitting to DefinitelyTyped. Even if they don't merge the PR, npm install *.git from GitHub is definitely an option.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
Ah ... Of course, I wasn't thinking about this context where a library was not originally authored in Typescript (but I was drunk so you can let me off). I'm sure there is tooling to introspect JavaScript libs and generate .d.ts files anyway. When there's a will there's a way.
I am Software Developer, currently interested in static type languages (TypeScript, Elm, ReScript) mostly in the frontend land, but working actively in Python also. I am available for mentoring.
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
So you see a definition file is not desirable to hand write because, it's bad enough maintaing code that actually do something, can you imagine refactoring this every time you make a change as well, people would rage quit typescript. I used to do it by hand then decide I cba. But there we go, you can and should generate as much as possible.
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.
This is actually not true. There are too many pure JavaScript projects with or without JSDoc (and sometimes TypeScript IntelliSense just doesn't read JSDoc...) That's why github.com/DefinitelyTyped/Definit... exists, which are actually hand-written
*.d.ts
's.(Though, I know it is possible to generate
*.d.ts
from JSDoc. I do that sometimes.)You can also add
*.d.ts
to a pure JavaScript project of someone else, without submitting to DefinitelyTyped. Even if they don't merge the PR,npm install *.git
from GitHub is definitely an option.Ah ... Of course, I wasn't thinking about this context where a library was not originally authored in Typescript (but I was drunk so you can let me off). I'm sure there is tooling to introspect JavaScript libs and generate .d.ts files anyway. When there's a will there's a way.
Yes there is github.com/microsoft/dts-gen
Thank you Maciej and thank you Microsoft.
So you see a definition file is not desirable to hand write because, it's bad enough maintaing code that actually do something, can you imagine refactoring this every time you make a change as well, people would rage quit typescript. I used to do it by hand then decide I cba. But there we go, you can and should generate as much as possible.