Broken nestled jsdoc comments for overloaded functions
See original GitHub issuePrettier 1.19.1 Playground link
--parser babel
Input:
const foo = "Bar";
/**
* @template T
* @param {Type} type
* @param {T} value
* @return {Value}
*//**
* @param {Type} type
* @return {Value}
*/
function value(type, value) {
if (arguments.length === 2) {
return new ConcreteValue(type, value);
} else {
return new Value(type);
}
}
Output:
const foo = "Bar";
/**
* @param {Type} type
* @return {Value}
*/
/**
* @template T
* @param {Type} type
* @param {T} value
* @return {Value}
*/ function value(type, value) {
if (arguments.length === 2) {
return new ConcreteValue(type, value);
} else {
return new Value(type);
}
}
Expected behavior: Output identical to input.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Documenting overloaded methods - Google Groups
Hello, I've been following JSDoc for nearly a couple of years now, and there's much to like! I still don't find the pipe|separation|of|method|params...
Read more >3 Ways To Write Function Overloads With JSDoc & TypeScript
This article will show you how use JSDoc to provide TypeScript type definitions for overloaded functions in JavaScript.
Read more >Document overloaded function in JSDoc - Stack Overflow
Save this question. Show activity on this post. I have an overloaded toggle function and want to document the behaviors w/ JSDoc.
Read more >PhpStorm - Code Inspections in JavaScript and TypeScript
Reports mismatch between the names and the number of parameters within a JSDoc comment and the actual parameters of a function. Suggests ...
Read more >angular-tslint-rules: a configuration preset for both ... - Medium
Do not invoke the super method twice in a constructor (except in branched statements or nested ... JSDoc comments should start with /**...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
TS does not support it but
tsd-jsdoc
does, so this is breaking a live process today. JSDoc does parse it correctly as demonstrated in their issue, linked above.Yes, TS doesn’t support this syntax. Related: https://github.com/microsoft/TypeScript/issues/25590