Skip to content

Commit 191b975

Browse files
author
Andy
authored
Clear jsDocCache for reused nodes (#21099)
1 parent 82fb294 commit 191b975

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/compiler/parser.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,11 @@ namespace ts {
16791679
return undefined;
16801680
}
16811681

1682+
if ((node as JSDocContainer).jsDocCache) {
1683+
// jsDocCache may include tags from parent nodes, which might have been modified.
1684+
(node as JSDocContainer).jsDocCache = undefined;
1685+
}
1686+
16821687
return node;
16831688
}
16841689

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @allowJs: true
4+
5+
// @Filename: /a.js
6+
/////** @type {/*type*/number} */
7+
////let /*x*/x;
8+
9+
verify.quickInfoAt("x", "let x: number");
10+
11+
goTo.marker("type");
12+
edit.replace(test.markers()[0].position, "number".length, "string");
13+
14+
verify.quickInfoAt("x", "let x: string");

0 commit comments

Comments
 (0)