otris / jsdoc-tsd

JSDoc template for generating TypeScript definition files based on JSDoc comments.
MIT License
29 stars 7 forks source link

Support for generic types #38

Closed whitlockjc closed 6 years ago

whitlockjc commented 6 years ago

Let's say I have a function that returns Promise<*>. When that is converted to TSD, shouldn't that be Promise.<any> and not Promise.<*>?

tineheller commented 6 years ago

Actually I think it should be Promise<any> instead of Promise.<*> or Promise.<any>. I'm not sure for now why there is a dot... but we'll have a look at this.

whitlockjc commented 6 years ago

I see that jsdoc2md/jsdoc-to-markdown does it too: https://github.com/whitlockjc/json-refs/blob/master/docs/API.md If you look at any of the parameterized types, you'll see a dot. Not sure if it's intentional or not but I think TypeScript doesn't need/want it.

wehrstedt commented 6 years ago

You are both right. It has to become Promise<any>. Like in https://github.com/otris/jsdoc-tsd/issues/39 it's a problem with the function mapVariableType.

It should not be that hard to fix, so if you like you can create a PR (or anybody else here) if you are faster than me :)

wehrstedt commented 6 years ago

Fixed with https://github.com/otris/jsdoc-tsd/pull/46