otris / jsdoc-tsd

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

How to document an external type? #72

Open MichalCz opened 5 years ago

MichalCz commented 5 years ago

Hi,

How should we document external modules in the code?

A simple example would be this:

/**
 * @returns {Readable} 
 */
function() { return fs.createReadStream('some-file.txt') }

In this case we mean import {Readable} from "stream" which should appear in the definition file.

wehrstedt commented 5 years ago

You should be able to simply provide the longname, there is nö validstion. Have you tried

/**
 * @returns {stream.Readable}
 */
MichalCz commented 5 years ago

I'll double-check tomorrow - but I remember it wasn't sufficient. Just as if it required that import in the begining. I'll get back to you tomorrow, but today I've had some wine already so my checks may be less than useful. :)