diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3833fc30875..fde03cc7db2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2721,11 +2721,11 @@ namespace ts { * Gets the effective type annotation of a variable, parameter, or property. If the node was * parsed in a JavaScript file, gets the type annotation from JSDoc. */ - export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode { + export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode | undefined { if (node.type) { return node.type; } - if (node.flags & NodeFlags.JavaScriptFile) { + if (isInJavaScriptFile(node)) { return getJSDocType(node); } } @@ -2734,11 +2734,11 @@ namespace ts { * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode { + export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode | undefined { if (node.type) { return node.type; } - if (node.flags & NodeFlags.JavaScriptFile) { + if (isInJavaScriptFile(node)) { return getJSDocReturnType(node); } }