property handle misspelled namepath in @typedef tag (#13702)
This commit is contained in:
parent
65125791d2
commit
71d1a3f051
|
@ -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();
|
||||
|
|
|
@ -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.
|
22
tests/baselines/reference/misspelledJsDocTypedefTags.types
Normal file
22
tests/baselines/reference/misspelledJsDocTypedefTags.types
Normal 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
|
||||
|
9
tests/cases/compiler/misspelledJsDocTypedefTags.ts
Normal file
9
tests/cases/compiler/misspelledJsDocTypedefTags.ts
Normal 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;
|
Loading…
Reference in a new issue