Skip to content

Commit 2561ced

Browse files
author
Andy
authored
Consistently use isInJavaScriptFile helper (microsoft#17075)
1 parent af147d1 commit 2561ced

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,7 @@ namespace ts {
42394239
return addOptionality(declaredType, /*optional*/ declaration.questionToken && includeOptionality);
42404240
}
42414241

4242-
if ((noImplicitAny || declaration.flags & NodeFlags.JavaScriptFile) &&
4242+
if ((noImplicitAny || isInJavaScriptFile(declaration)) &&
42434243
declaration.kind === SyntaxKind.VariableDeclaration && !isBindingPattern(declaration.name) &&
42444244
!(getCombinedModifierFlags(declaration) & ModifierFlags.Export) && !isInAmbientContext(declaration)) {
42454245
// If --noImplicitAny is on or the declaration is in a Javascript file,
@@ -4493,7 +4493,7 @@ namespace ts {
44934493
if (declaration.kind === SyntaxKind.ExportAssignment) {
44944494
return links.type = checkExpression((<ExportAssignment>declaration).expression);
44954495
}
4496-
if (declaration.flags & NodeFlags.JavaScriptFile && declaration.kind === SyntaxKind.JSDocPropertyTag && (<JSDocPropertyTag>declaration).typeExpression) {
4496+
if (isInJavaScriptFile(declaration) && declaration.kind === SyntaxKind.JSDocPropertyTag && (<JSDocPropertyTag>declaration).typeExpression) {
44974497
return links.type = getTypeFromTypeNode((<JSDocPropertyTag>declaration).typeExpression.type);
44984498
}
44994499
// Handle variable, parameter or property
@@ -4552,7 +4552,7 @@ namespace ts {
45524552
const getter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.GetAccessor);
45534553
const setter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.SetAccessor);
45544554

4555-
if (getter && getter.flags & NodeFlags.JavaScriptFile) {
4555+
if (getter && isInJavaScriptFile(getter)) {
45564556
const jsDocType = getTypeForDeclarationFromJSDocComment(getter);
45574557
if (jsDocType) {
45584558
return links.type = jsDocType;
@@ -6206,7 +6206,7 @@ namespace ts {
62066206
}
62076207

62086208
function isJSDocOptionalParameter(node: ParameterDeclaration) {
6209-
if (node.flags & NodeFlags.JavaScriptFile) {
6209+
if (isInJavaScriptFile(node)) {
62106210
if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) {
62116211
return true;
62126212
}

src/compiler/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ namespace ts {
16191619
}
16201620

16211621
export function isRestParameter(node: ParameterDeclaration) {
1622-
if (node && (node.flags & NodeFlags.JavaScriptFile)) {
1622+
if (isInJavaScriptFile(node)) {
16231623
if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType ||
16241624
forEach(getJSDocParameterTags(node),
16251625
t => t.typeExpression && t.typeExpression.type.kind === SyntaxKind.JSDocVariadicType)) {
@@ -2743,7 +2743,7 @@ namespace ts {
27432743
if (node.typeParameters) {
27442744
return node.typeParameters;
27452745
}
2746-
if (node.flags & NodeFlags.JavaScriptFile) {
2746+
if (isInJavaScriptFile(node)) {
27472747
const templateTag = getJSDocTemplateTag(node);
27482748
return templateTag && templateTag.typeParameters;
27492749
}

0 commit comments

Comments
 (0)