Skip to content

Allow hyphenated JSDoc tags #2972

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

Merged

Conversation

jonathanhefner
Copy link
Contributor

@jonathanhefner jonathanhefner commented Jul 7, 2025

JSDoc tags may contain hyphens. For example, @TJS-type, which is used by typescript-json-schema.


There are no existing tests for this function, but I can add a test for this change, if desired. (This test is close, but it is testing other functionality, not isTagString itself.)

I stand corrected. This test was recently added, explicitly disallowing hyphenated tags. I'm unclear as to why though. Is there a reason to reject hyphenated tags?

@jonathanhefner jonathanhefner force-pushed the allow-hyphenated-jsdoc-tags branch 2 times, most recently from a080fdf to 8140e00 Compare July 7, 2025 16:38
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 8, 2025

TypeDoc doesn't support hyphenated tags because TSDoc disallows it:

Tag names start with an at-sign (@) followed by ASCII letters using "camelCase" capitalization.
https://tsdoc.org/pages/spec/tag_kinds/

And no official JSDoc tag uses it - https://jsdoc.app/

In theory, I don't think I have an issue with adding hyphen to the permitted characters list -- this isn't enough though, the lexers in src/lib/converter/comments will also need to be updated.

JSDoc tags may contain hyphens.  For example, `@TJS-type`, which is used
by [`typescript-json-schema`](https://www.npmjs.com/package/typescript-json-schema).
@jonathanhefner jonathanhefner force-pushed the allow-hyphenated-jsdoc-tags branch from 8140e00 to 9121d78 Compare July 8, 2025 16:35
@jonathanhefner
Copy link
Contributor Author

the lexers in src/lib/converter/comments will also need to be updated.

Thanks for the pointer! I've updated the lexers.

@Gerrit0 Gerrit0 merged commit 2443ca9 into TypeStrong:master Jul 9, 2025
8 checks passed
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 9, 2025

Thanks!

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 this pull request may close these issues.

2 participants