property handle misspelled namepath in @typedef tag (#13702)

This commit is contained in:
Vladimir Matveev 2017-01-26 11:38:50 -08:00 committed by GitHub
parent 65125791d2
commit 71d1a3f051
4 changed files with 46 additions and 2 deletions

View file

@ -6693,10 +6693,15 @@ namespace ts {
typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0);
if (typedefTag.fullName) {
let rightNode = typedefTag.fullName;
while (rightNode.kind !== SyntaxKind.Identifier) {
while (true) {
if (rightNode.kind === SyntaxKind.Identifier || !rightNode.body) {
// if node is identifier - use it as name
// otherwise use name of the rightmost part that we were able to parse
typedefTag.name = rightNode.kind === SyntaxKind.Identifier ? rightNode : rightNode.name;
break;
}
rightNode = rightNode.body;
}
typedefTag.name = rightNode;
}
typedefTag.typeExpression = typeExpression;
skipWhitespace();

View file

@ -0,0 +1,8 @@
=== tests/cases/compiler/a.js ===
No type information for this code./** @typedef {{ endTime: number, screenshots: number}} A.<b>*/
No type information for this code.Animation.AnimationModel.ScreenshotCapture.Request;
No type information for this code.
No type information for this code./** @typedef {{ endTime: number, screenshots: !B.<string>}} */
No type information for this code.Animation.AnimationModel.ScreenshotCapture.Request;
No type information for this code.

View file

@ -0,0 +1,22 @@
=== tests/cases/compiler/a.js ===
/** @typedef {{ endTime: number, screenshots: number}} A.<b>*/
Animation.AnimationModel.ScreenshotCapture.Request;
>Animation.AnimationModel.ScreenshotCapture.Request : any
>Animation.AnimationModel.ScreenshotCapture : any
>Animation.AnimationModel : any
>Animation : any
>AnimationModel : any
>ScreenshotCapture : any
>Request : any
/** @typedef {{ endTime: number, screenshots: !B.<string>}} */
Animation.AnimationModel.ScreenshotCapture.Request;
>Animation.AnimationModel.ScreenshotCapture.Request : any
>Animation.AnimationModel.ScreenshotCapture : any
>Animation.AnimationModel : any
>Animation : any
>AnimationModel : any
>ScreenshotCapture : any
>Request : any

View file

@ -0,0 +1,9 @@
// @allowJs: true
// @noEmit: true
// @filename: a.js
/** @typedef {{ endTime: number, screenshots: number}} A.<b>*/
Animation.AnimationModel.ScreenshotCapture.Request;
/** @typedef {{ endTime: number, screenshots: !B.<string>}} */
Animation.AnimationModel.ScreenshotCapture.Request;