Remove special handling for JSDocPropertyLikeTag in getJSSpecialType (#26432)
* Remove special handling for JSDocPropertyLikeTag in getJSSpecialType * Reduce nesting
This commit is contained in:
parent
a1089893bd
commit
62e6e6ae27
2 changed files with 3 additions and 4 deletions
|
@ -5090,9 +5090,6 @@ namespace ts {
|
|||
if (!isInJavaScriptFile(decl)) {
|
||||
return undefined;
|
||||
}
|
||||
else if (isJSDocPropertyLikeTag(decl) && decl.typeExpression) {
|
||||
return getTypeFromTypeNode(decl.typeExpression.type);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
|
|
|
@ -3358,7 +3358,9 @@ namespace ts {
|
|||
* parsed in a JavaScript file, gets the type annotation from JSDoc.
|
||||
*/
|
||||
export function getEffectiveTypeAnnotationNode(node: Node): TypeNode | undefined {
|
||||
return (node as HasType).type || (isInJavaScriptFile(node) ? getJSDocType(node) : undefined);
|
||||
const type = (node as HasType).type;
|
||||
if (type || !isInJavaScriptFile(node)) return type;
|
||||
return isJSDocPropertyLikeTag(node) ? node.typeExpression && node.typeExpression.type : getJSDocType(node);
|
||||
}
|
||||
|
||||
export function getTypeAnnotationNode(node: Node): TypeNode | undefined {
|
||||
|
|
Loading…
Reference in a new issue