factor out isJsxOrTsxExtension

This commit is contained in:
Andy Hanson 2016-06-06 12:17:11 -07:00
parent 9575b3c3ca
commit a918730df0
2 changed files with 5 additions and 1 deletions

View file

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

View file

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