Skip to content

Commit 6d8a5f6

Browse files
author
Andy
authored
Fix invalid cast: JSDocSignature is not a SignatureDeclaration (#25734)
1 parent d28fb65 commit 6d8a5f6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/compiler/parser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ namespace ts {
494494
case SyntaxKind.JSDocSignature:
495495
return visitNodes(cbNode, cbNodes, node.decorators) ||
496496
visitNodes(cbNode, cbNodes, node.modifiers) ||
497-
visitNodes(cbNode, cbNodes, (<SignatureDeclaration>node).typeParameters) ||
498-
visitNodes(cbNode, cbNodes, (<SignatureDeclaration>node).parameters) ||
499-
visitNode(cbNode, (<SignatureDeclaration>node).type);
497+
forEach((<JSDocSignature>node).typeParameters, cbNode) ||
498+
forEach((<JSDocSignature>node).parameters, cbNode) ||
499+
visitNode(cbNode, (<JSDocSignature>node).type);
500500
case SyntaxKind.JSDocTypeLiteral:
501501
if ((node as JSDocTypeLiteral).jsDocPropertyTags) {
502502
for (const tag of (node as JSDocTypeLiteral).jsDocPropertyTags!) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
/////**
4+
//// * @callback Cb
5+
//// * @return {/**/}
6+
//// */
7+
////let x;
8+
9+
// Previously this crashed due to an invalid cast in `forEachChild` for `JSDocSignature`.
10+
11+
goTo.marker("");
12+
edit.insert("number");

0 commit comments

Comments
 (0)