Remove special handling for JSDocPropertyLikeTag in getJSSpecialType (#26432)

* Remove special handling for JSDocPropertyLikeTag in getJSSpecialType

* Reduce nesting
This commit is contained in:
Andy 2018-08-14 13:48:17 -07:00 committed by GitHub
parent a1089893bd
commit 62e6e6ae27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -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

View file

@ -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 {