File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,13 @@ namespace ts {
275
275
}
276
276
277
277
export function getContainerNode ( node : Node ) : Declaration {
278
+ if ( node . kind === SyntaxKind . JSDocTypedefTag ) {
279
+ // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope.
280
+ // node.parent = the JSDoc comment, node.parent.parent = the node having the comment.
281
+ // Then we get parent again in the loop.
282
+ node = node . parent . parent ;
283
+ }
284
+
278
285
while ( true ) {
279
286
node = node . parent ;
280
287
if ( ! node ) {
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts'/>
2
+
3
+ // Tests that the scope of @typedef is not just the node immediately below it.
4
+
5
+ // @allowJs : true
6
+
7
+ // @Filename : /a.js
8
+ /////** @typedef {number } [|{| "isWriteAccess": true, "isDefinition": true |}T|] */
9
+ ////
10
+ /////**
11
+ //// * @return {[|T|] }
12
+ //// */
13
+ ////function f(obj) { return 0; }
14
+ ////
15
+ /////**
16
+ //// * @return {[|T|] }
17
+ //// */
18
+ ////function f2(obj) { return 0; }
19
+
20
+ verify . singleReferenceGroup ( "type T = number" ) ;
You can’t perform that action at this time.
0 commit comments