mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Merge pull request #6851 from RyanCavanaugh/fix6814
Allow parsing TS-style generics in JSDoc
This commit is contained in:
@@ -5750,16 +5750,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);
|
||||
}
|
||||
|
||||
|
||||
34
tests/cases/fourslash/jsDocGenerics1.ts
Normal file
34
tests/cases/fourslash/jsDocGenerics1.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: ref.d.ts
|
||||
//// namespace Thing {
|
||||
//// export interface Thung {
|
||||
//// a: number;
|
||||
//// ]
|
||||
//// ]
|
||||
|
||||
|
||||
// @Filename: Foo.js
|
||||
////
|
||||
//// /** @type {Array<number>} */
|
||||
//// var v;
|
||||
//// v[0]./*1*/
|
||||
////
|
||||
//// /** @type {{x: Array<Array<number>>}} */
|
||||
//// var w;
|
||||
//// w.x[0][0]./*2*/
|
||||
////
|
||||
//// /** @type {Array<Thing.Thung>} */
|
||||
//// var x;
|
||||
//// x[0].a./*3*/
|
||||
|
||||
|
||||
goTo.marker('1');
|
||||
verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
|
||||
goTo.marker('2');
|
||||
verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
Reference in New Issue
Block a user