-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
Bug Report
For JavaScript typed with the JSDoc version of TypeScript.
Then TS gives JSDoc error on ...rest parameter, even when the prescribed fix in the error msg is implemented.
Could be related to this PR: #29352
Which was implemented as a fix for this issue: #27010
🔎 Search Terms
ts8032 rest, ts 8032 typescript, jsdoc typescript type rest object
🕗 Version & Regression Information
› npx tsc -v
Version 4.6.2
- This is a crash
⏯ Playground Link
Playground link with relevant code
💻 Code
// @ts-check
// Error: `Qualified name '...rest' is not allowed without a leading '@param {object} ..'. ts(8032)`
/**
* @param {object} ...rest
*/
function f1 (...rest) {
return rest
}
// Works:
// But this is slightly problematic, as the JSDoc then will give a wrong indication to the user of the function:
// by indicating a single input object, instead of a variable amount of input objects.
/**
* @param {object} rest
*/
function f2 (...rest) {
return rest
}🙁 Actual behavior
The f1 case gives error on the ...rest parameter in the JSDoc.
The f2 case renders the documentation as @param rest which is misleading.
🙂 Expected behavior
No error on the ...rest parameter in the JSDoc. Since the code implements exactly what the error message prescribes (adding or removing dots doesn't help).
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code