Skip to content

Commit 62e6e6a

Browse files
author
Andy
authored
Remove special handling for JSDocPropertyLikeTag in getJSSpecialType (microsoft#26432)
* Remove special handling for JSDocPropertyLikeTag in getJSSpecialType * Reduce nesting
1 parent a108989 commit 62e6e6a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5090,9 +5090,6 @@ namespace ts {
50905090
if (!isInJavaScriptFile(decl)) {
50915091
return undefined;
50925092
}
5093-
else if (isJSDocPropertyLikeTag(decl) && decl.typeExpression) {
5094-
return getTypeFromTypeNode(decl.typeExpression.type);
5095-
}
50965093
// Handle certain special assignment kinds, which happen to union across multiple declarations:
50975094
// * module.exports = expr
50985095
// * exports.p = expr

src/compiler/utilities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3358,7 +3358,9 @@ namespace ts {
33583358
* parsed in a JavaScript file, gets the type annotation from JSDoc.
33593359
*/
33603360
export function getEffectiveTypeAnnotationNode(node: Node): TypeNode | undefined {
3361-
return (node as HasType).type || (isInJavaScriptFile(node) ? getJSDocType(node) : undefined);
3361+
const type = (node as HasType).type;
3362+
if (type || !isInJavaScriptFile(node)) return type;
3363+
return isJSDocPropertyLikeTag(node) ? node.typeExpression && node.typeExpression.type : getJSDocType(node);
33623364
}
33633365

33643366
export function getTypeAnnotationNode(node: Node): TypeNode | undefined {

0 commit comments

Comments
 (0)