3 ms·
JSDoc is missing a lot of basic capabilities. For example a TypeDef is automatically exported which can cause collisions and forces you to repeat or inline type
by apatheticonion 10mo ago
JSDoc is missing a lot of basic capabilities. For example a TypeDef is automatically exported which can cause collisions and forces you to repeat or inline types.
Types for classes are poor and often you'll find yourself creating a `.d.ts` file or `.ts` file to export non trivial types - however the target file doesn't know how to consume them.
- culi 10mo agotypedefs are indeed automatically exported but that doesn't mean collisions can happen. You would still have to explicitly import a type Regardless, I hardly consider that a "missing basic capability" I don't know what you mean about types for classes being "poor". Types for classes work exactly the same way
- apatheticonion 10mo agoYou cannot replicate `import type { x } from './foo'` without also re-exporting that import - which causes collisions. The alternative is to do an inline `const foo = /** @type {import('./foo').x} */ ({})` however this gets messy, repetitive and it's difficult to use algebraic types (e.g. `Event & { detail: string }`)
- rangedbarbarian 10mo agoWould `import type { x as y } from `./foo.x` not work?