File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,6 +275,13 @@ namespace ts {
275275 }
276276
277277 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+
278285 while ( true ) {
279286 node = node . parent ;
280287 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