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

Functions do no output unsupported tags #1220

Closed
1 task done
epzilla opened this issue Feb 26, 2020 · 2 comments · Fixed by #1221
Closed
1 task done

Functions do no output unsupported tags #1220

epzilla opened this issue Feb 26, 2020 · 2 comments · Fixed by #1221

Comments

@epzilla
Copy link
Contributor

epzilla commented Feb 26, 2020

Expected Behavior

According to the docs: TypeDoc renders any unsupported tags in a list in the documentation, so they are not lost.

Actual Behavior

This seems to work fine with class methods defined like this:

// ... inside a class

/**
 * Test method
 * @deprecated
 */
 someMethod() { ...

... but when I try to add an unsupported tag to a regular function, arrow function, or even to a class method that's defined with arrow-function syntax:

// ... inside a class

/**
 * Test method
 * @deprecated
 */
 someMethod = () => { ...

// ... or in a module instead of a class...

/**
 * Test method
 * @deprecated
 */
 export const someMethod = () => { ...

/**
 * Another test method
 * @deprecated
 */
 export function someMethod1() { ...

The tag doesn't show up in the generated documentation for any of those. When I output the JSON, I see that the comment has that tag, but it isn't being rendered in the output. This may very well be that I'm just doing something wrong! But I'd love to know what that is. 😄

Steps to reproduce the bug

  • Define a class withe method, and add an @deprecated tag to the comment for that method
  • Define another method on the class, but declare it with arrow function syntax (or if you like, create some other module that just has a regular exported function. In most of mine I have them as const declarations with arrow-function syntax)
  • Generate the output
  • Observe that the @deprecated tag shows up in the documentation for the first one, but not the second.

Environment

  • Typedoc version: 0.16.10
  • Node.js version: 12.13.0
  • OS: Windows 10 / Mac OS X
@epzilla epzilla added the bug Functionality does not match expectation label Feb 26, 2020
@epzilla
Copy link
Contributor Author

epzilla commented Feb 26, 2020

Example where it's working as expected, from a class with a method declared in the non-arrow-function way:
method-example

Example where it isn't showing up, from a module with an exported const arrow function:
function-example

@epzilla
Copy link
Contributor Author

epzilla commented Feb 27, 2020

Update: Looks like there is a discrepancy in the JSON as well, I just didn't notice it before. It looks like when you generate the JSON in the 1st case, where it's a regular method declaration, the comments array gets put both at the root level and also inside of the signatures array, but when you change it to the 2nd way and then generate the JSON, comments only gets put inside the signatures array and doesn't get put in the root level of the object.

Side-by-side comparison here:
Screen Shot 2020-02-27 at 12 05 59 AM

1st way (outputs the tags correctly in the HTML):

{
  "id": 5,
  "name": "testMethod",
  "kind": 2048,
  "kindString": "Method",
  "flags": {
    "isPublic": true,
    "isExported": true
  },
  "comment": {
    "shortText": "This will do some test things",
    "tags": [
      {
        "tag": "deprecated",
        "text": ""
      }
    ]
  },
  "signatures": [
    {
      "id": 6,
      "name": "testMethod",
      "kind": 4096,
      "kindString": "Call signature",
      "flags": {
        "isExported": true
      },
      "comment": {
        "shortText": "This will do some test things"
      },
      ...

2nd way (does not output the tags in the HTML:

{
  "id": 5,
  "name": "testMethod",
  "kind": 2048,
  "kindString": "Method",
  "flags": {
    "isPublic": true,
    "isExported": true
  },
  "signatures": [
    {
      "id": 6,
      "name": "testMethod",
      "kind": 4096,
      "kindString": "Call signature",
      "flags": {
        "isExported": true
      },
      "comment": {
        "shortText": "This will do some test things",
        "tags": [
          {
            "tag": "deprecated",
            "text": ""
          }
        ]
      },
      ...

@Gerrit0 Gerrit0 removed the bug Functionality does not match expectation label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants