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

when using ts.getJSDocTags, the value of @type is not returned. Is there any solution? #58314

Closed
canyuegongzi opened this issue Apr 25, 2024 · 2 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@canyuegongzi
Copy link

🔎 Search Terms

ts.getJSDocTags、type、get jsDoc、 get js doc tags

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions 5.4.5 and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

No response

💻 Code

export default interface CommonHeaderIProps {
  /**
   * name
   *
   * @title name
   * @type string
   * @default true
   */
  testList: TestListData;
}

// code
const jsdoc = ts.getJSDocTags(node);
// code

🙁 Actual behavior

the value of type is not actually returned
{ title: 'name', type: undefined, default: 'true' }
image

🙂 Expected behavior

Can correctly return the value string of @type annotation instead of returning undefined,
example:
{ title: 'name', type: 'string', default: 'true' }

Additional information about the issue

No response

@IllusionMH
Copy link
Contributor

Syntax is @type {typeName} and your example is missing curly braces. Does it work if you add them?

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Apr 25, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Question" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants