Skip to content

Commit a918730

Browse files
author
Andy Hanson
committed
factor out isJsxOrTsxExtension
1 parent 9575b3c commit a918730

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/compiler/core.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,10 @@ namespace ts {
861861
return fileExtensionIs(path, extension) ? path.substring(0, path.length - extension.length) : undefined;
862862
}
863863

864+
export function isJsxOrTsxExtension(ext: string): boolean {
865+
return ext === ".jsx" || ext === ".tsx";
866+
}
867+
864868
export interface ObjectAllocator {
865869
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
866870
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;

src/compiler/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ namespace ts {
646646
return forEach(extensions, tryLoad);
647647

648648
function tryLoad(ext: string): string {
649-
if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) {
649+
if (state.skipTsx && isJsxOrTsxExtension(ext)) {
650650
return undefined;
651651
}
652652
const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;

0 commit comments

Comments
 (0)