Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support using types declared in JSDoc comments #393

Open
bdelseny opened this issue Nov 7, 2023 · 5 comments
Open

support using types declared in JSDoc comments #393

bdelseny opened this issue Nov 7, 2023 · 5 comments
Labels

Comments

@bdelseny
Copy link

bdelseny commented Nov 7, 2023

When using deno doc without the html option and JavaScript files, it correctly output the attributes/properties/parameters type hint, see below.

When using the html, the rendered html does not output type hints, see the capture below.
In html there is also no output for the constructor documentation not class properties.

User story if needed: HTML documentation output should render type hints on JavaScript files and also display class properties information

Link to my repository: https://gitlab.com/libshare/pwa

Without html option Command Line:

gitpod /workspace/pwa (master) $ deno doc  ./public/object/media.js
Defined in file:///workspace/pwa/public/object/media.js:44:1

function toto(a, b): void
  Function that does stuff

  @param {number} a
      a

  @param {string} b
      c


Defined in file:///workspace/pwa/public/object/media.js:12:1

class Media
  Media object definition

  @property {string} type
      Media Type

  @property {string} title
      Media type

  @property {string|string[]} authors
      Media authors

  @property {string} description
      Media description or abstract

  @property {string} coverImageUrl
      Media cover image URL

  @property {Date} publicationDate
      Media publication Date

  @public
  @constructor

  constructor(title, authors, description, coverImageUrl, publicationDate)

    @param {string} title
        Media type

    @param {string|string[]} authors
        Media authors

    @param {string} description
        Media description or abstract

    @param {string} coverImageUrl
        Media cover image URL

    @param {Date} publicationDate
        Media publication Date

With html option
image
image

If the issue is not well-formatted or need more information I will gladly improve its content
BTW: thanks for implementing the HTML option, I have been waiting for it :)

Edit: added a link my repository

@crowlKats
Copy link
Member

crowlKats commented Nov 7, 2023

This is an odd bug.
Can you share your code, and is this on deno.land/x and if so, does it render the same or is it correct there?

@crowlKats crowlKats added the html label Nov 7, 2023
@JakobHock
Copy link

I'm having the same Issues.

Additionally it also ignores JSDoc typedefinitions.
Something like:

/**
 * @typedef  {Object}    input          - An input
 * @property {number[]}  input.string - Example prop
 * @property {number}    input.num - Example prop
 */

/**
 * To decode the uplink data
 * @access private
 * @param   {input}     input - The object to decode
 * @returns {output}          - The decoded object
 */
function decode(input) {
 ...
}

is not included in the HTML output.

image

@bdelseny
Copy link
Author

bdelseny commented Nov 8, 2023

This i an odd bug. Can you share your code, and is this on deno.land/x and if so, does it render the same or is it correct there?

I do not publish on deno.land/x, thus I do not know if it also occurs on it.

I edited my issue to add a link to my repository: https://gitlab.com/libshare/pwa

After a pull, calling deno doc --html public/object/media.js should provide the doc with the bug described.

TypeScript documentation seems to be generated with the types in it, I suppose the {type} info from doc comments is not correctly parsed. With TypeScript it is probably taking the real type directly. Example from deno note seems to work as expected on TypeScript example from deno

@bdelseny
Copy link
Author

bdelseny commented Nov 9, 2023

I created a new repository with only one JavaScript file, with a function and a class in it, with JSDoc comments.

I host it on both Gitlab and Github, and attached a hook to deno.land/x.
it is in order to answer with as many info as possible your question @crowlKats :

This i an odd bug. Can you share your code, and is this on deno.land/x and if so, does it render the same or is it correct there?

As an answer, it seems neither the local deno doc --html nor deno.land handle the JSDoc {type}.

I hope I did it correctly for the hook, it's my first time.

Here are links for you to check:

@nberlette
Copy link

Sorry to dig up an old-ish issue, but I'm having the same problem with constructor parameters intermittently. I'll try to throw together a repro as soon as I can.

@crowlKats crowlKats changed the title [HTML] Parameters and properties type not added to doc support using types declared in JSDoc comments Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants