-
Notifications
You must be signed in to change notification settings - Fork 485
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 literal enum of strings #662
Comments
Yep, we already support the examples given that issue, with the exception that /**
* @param {MediaType} mediaType - Type of the media
*/
function foo(mediaType){};
/**
* @type {('MP4'|'WEBM')} MediaType - Allowed media types
*/ Should have Feel free to file an issue if you see the existing support lacking in any way! |
Thanks for your answer. I should have elaborated a bit more. I'm talking about literal, in-place or anonymous enums without any reference to existing This currently crashes: /**
* @param {('pre'|'post')} [order='pre'] Traversal mode
* or
* @param {'pre'|'post'} [order='pre'] Traversal mode
*/ Output> documentation build lib/*.js --format md --output docs/api.md
/Users/ngryman/Projects/arbre/node_modules/documentation/lib/commands/build.js:67
throw err;
^
Error: Unknown type StringLiteralType
at formatType (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/util/format_type.js:174:11)
at commaList (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/util/format_type.js:60:22)
at formatType (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/util/format_type.js:125:12)
at formatType (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/util/format_type.js:166:30)
at /Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/markdown_ast.js:48:41
at Array.map (native)
at paramList (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/markdown_ast.js:43:51)
at paramSection (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/markdown_ast.js:66:9)
at generate (/Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/markdown_ast.js:175:13)
at /Users/ngryman/Projects/arbre/node_modules/documentation/lib/output/markdown_ast.js:194:26 This works by misinterpreting /**
* @param {pre|post} [order='pre'] Traversal mode
*/ EDIT: I edited the title to try to be more precise. |
What version of documentation.js are you using? That input also works for me, and we've supported StringLiteralType since v4.0.0-beta.18 |
I'm using |
Should that repository fail on
|
Yes sorry I didn't push the crashing jsdoc code. I've pushed it in the |
✨ I can confirm that the issue is present in documentation.js < beta.18 and fixed in beta.18 and beyond. Partly this is due to semver, unfortunately: specifying Going to write a testcase for this problem and close with that PR. |
Is #629 fixed? |
Hey,
Would you consider supporting
@param
enum of strings like those in this proposal: jsdoc/jsdoc#629.Thanks!
The text was updated successfully, but these errors were encountered: