englercj / tsd-jsdoc

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

Add support for rest-parameter tuple types #149

Open thw0rted opened 2 years ago

thw0rted commented 2 years ago

I've run into an incompatibility between JSDoc and Typescript, and I'm really not sure how to fix it.

The short version is, I need to create the type function foo(...args: [A, B]) -- or, more specifically, function foo(...args: Parameters<OtherFunc>) -- but the JSDoc format for rest-parameters automatically turns @parameter {...X} into an array of X, as you already discovered.

As you're probably aware, JSDoc hasn't added any new features for over 5 years now, so I'm not counting on them to fix this. I actually think even if you switched to the TS compiler, there might not be a syntax to support this. I'm going to post an issue over there, and mention this one in hopes that somebody has an idea of how to move forward.

thw0rted commented 2 years ago

Created https://github.com/microsoft/TypeScript/issues/49801 , in case you want to track.