4 ms·
I don't want to use Typescript for everything. A recent example is a Chrome extension I wrote for the sake of proving out a feature. Totally not interested in
by ravenstine 4y ago
I don't want to use Typescript for everything.
A recent example is a Chrome extension I wrote for the sake of proving out a feature.
Totally not interested in setting up a build system, dealing with dependencies, type safety, and so forth. I just want to write code and immediately see it run. Having JSDoc is nice to document more than just types, but type hints can be helpful.
> My question is how do you reuse and test the JS doc signatures? Can I export comments? Will my tests fail if the types mismatch?
You can import types now, at least with VS Code.
```
/*
* @typedef {import('./types.js').MyType} MyType
*/
```
Haven't found myself using it, though.
- c-hendricks 4y ago> You can import types now When using TypeScript to avoid using TypeScript, yeah. It's not valid JSDoc: https://github.com/jsdoc/jsdoc/issues/1645 https://github.com/jsdoc/jsdoc/issues/1645