From a918730df0919357fbe8accd88a873991ef11fa6 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Jun 2016 12:17:11 -0700 Subject: [PATCH] factor out isJsxOrTsxExtension --- src/compiler/core.ts | 4 ++++ src/compiler/program.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ba81ee7d103..8a2040a83df 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -861,6 +861,10 @@ namespace ts { return fileExtensionIs(path, extension) ? path.substring(0, path.length - extension.length) : undefined; } + export function isJsxOrTsxExtension(ext: string): boolean { + return ext === ".jsx" || ext === ".tsx"; + } + export interface ObjectAllocator { getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0c060807b1f..5440b1a782b 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -646,7 +646,7 @@ namespace ts { return forEach(extensions, tryLoad); function tryLoad(ext: string): string { - if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) { + if (state.skipTsx && isJsxOrTsxExtension(ext)) { return undefined; } const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;