Generic variables need a typedef so that they they can be used to create .d.ts file
Closed this issue · 0 comments
FranzZemen commented
When defining a type using generics, the generic variables need a typedef. Other
typescript source:
export type NeverType<T, Type> = T extends Type ? never : T;
javascript input:
/** @typedef {T extends Type ? never : T} NeverType */ // No typedef for T or Type causes an error when generate ts from js
typescript definition re-generated (using allowJs) to .d.ts
export type NeverType = T extends Type ? never : T;
Adding the following to the javascript output solves the error (there may be other ways, not a JSDoc expert)
/** @typedef {any} T */
/** @typedef {any} Type */