Skip to content

Commit

Permalink
Allow parsing TS-style generics in JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Feb 2, 2016
1 parent 554ea1b commit 6e06bb3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5734,16 +5734,22 @@ namespace ts {
const result = <JSDocTypeReference>createNode(SyntaxKind.JSDocTypeReference);
result.name = parseSimplePropertyName();

while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
}
else {
while (parseOptional(SyntaxKind.DotToken)) {
if (token === SyntaxKind.LessThanToken) {
result.typeArguments = parseTypeArguments();
break;
}
else {
result.name = parseQualifiedName(result.name);
}
}
}


return finishNode(result);
}

Expand Down
10 changes: 10 additions & 0 deletions tests/cases/fourslash/jsDocGenerics1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
///<reference path="fourslash.ts" />

// @allowNonTsExtensions: true
// @Filename: Foo.js
//// /** @type {Array<number>} */
//// var v;
//// v[0]./**/

goTo.marker();
verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");

0 comments on commit 6e06bb3

Please sign in to comment.