englercj / tsd-jsdoc

Compiles JSDoc annotated JavaScript into a Typescript Definition file (.d.ts)
MIT License
316 stars 42 forks source link

Number[] export is not consistent with plain Number #117

Open TheJonRobinson opened 4 years ago

TheJonRobinson commented 4 years ago

For me tsd works great except for what seems like an inconsistency dealing with Number[]?

Simple test file:

/**
 * @type {Number|Number[]}
  */
var numberArray = [];

Output:

/**
 * @type {Number|Number[]}
 */
declare var numberArray: number | Number[];

Number becomes a plain number but Number[] remains Number[]. This results in Typescript (correctly) grumbling:

'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.

I'm using tsd on a 3rd party project (i.e. not trivial to alter the source), and this does seem inconsistent behaviour.

englercj commented 4 years ago

Looks like a bug, thanks for bringing it up!