You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSDoc allows you to specify the type of parameters or the return value in JavaScript code like:
/** * Represents a book. * @param {string} title - The title of the book. * @param {string} author - The author of the book. * @returns {boolean} */functionBook(title,author){}
However, though Deno 2 claims to support both TypeScript and JavaScript development, it doesn't support this method of specifying types. To be more specific, when I include JSDoc like the above, the {string} and {boolean} strings are ignored and the documentation produced doesn't include the type of parameters or return values.
The text was updated successfully, but these errors were encountered:
Can you show a full reproduction (What does your file look like? What command are you running?)? Does that javascript file have // @ts-check at the top?
Since the input file is a JavaScript file, it definitely does not have // @ts-check anywhere in it. Here is a sample input file, which I've named book.js and placed in my src/lib folder:
/** * book - provides functions for use in unit tests * * @module *//** * Represents a book * * @param {string} title * @param {string} author * @returns {boolean} */exportconstbook=(title,author)=>{returntrue}
Next, I run deno doc --html src/lib/book.js (my project has the folder src/lib). This command creates a folder named docs, which contains a bunch of files, including an index.html. When I open that file with Chrome, I see this:
When I click on the word book, I see this:
Note that there is no type information associated with the parameters, and the return type is listed as "unknown", even though the type information is there in my JSDoc block.
$ deno --version
deno 2.1.4 (stable, release, x86_64-pc-windows-msvc)
v8 13.0.245.12-rusty
typescript 5.6.2
JSDoc allows you to specify the type of parameters or the return value in JavaScript code like:
However, though Deno 2 claims to support both TypeScript and JavaScript development, it doesn't support this method of specifying types. To be more specific, when I include JSDoc like the above, the
{string}
and{boolean}
strings are ignored and the documentation produced doesn't include the type of parameters or return values.The text was updated successfully, but these errors were encountered: