Skip to content

Commit d4b8889

Browse files
author
Andy Hanson
committed
Respond to more PR comments
1 parent f4d6b67 commit d4b8889

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/compiler/core.ts

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

864-
export function getFileExtension(path: string): string {
865-
const dot = path.lastIndexOf(".");
866-
if (dot !== -1) {
867-
return path.substring(dot);
868-
}
869-
}
870-
871864
export interface ObjectAllocator {
872865
getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node;
873866
getSourceFileConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => SourceFile;

src/compiler/program.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ namespace ts {
620620
*/
621621
function loadModuleFromFile(candidate: string, extensions: string[], failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): string {
622622
// First try to keep/add an extension: importing "./foo.ts" can be matched by a file "./foo.ts", and "./foo" by "./foo.d.ts"
623-
const keepOrAddExtension = loadModuleFromFileWorker(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
624-
if (keepOrAddExtension) {
625-
return keepOrAddExtension;
623+
const resolvedByAddingOrKeepingExtension = loadModuleFromFileWorker(candidate, extensions, failedLookupLocation, onlyRecordFailures, state);
624+
if (resolvedByAddingOrKeepingExtension) {
625+
return resolvedByAddingOrKeepingExtension;
626626
}
627627
// Then try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one, e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts"
628628
if (hasJavaScriptFileExtension(candidate)) {
@@ -634,9 +634,10 @@ namespace ts {
634634
return loadModuleFromFileWorker(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state);
635635
}
636636
}
637+
637638
function loadModuleFromFileWorker(candidate: string, extensions: string[], failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): string {
638639
if (!onlyRecordFailures) {
639-
// check if containig folder exists - if it doesn't then just record failures for all supported extensions without disk probing
640+
// check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
640641
const directory = getDirectoryPath(candidate);
641642
if (directory) {
642643
onlyRecordFailures = !directoryProbablyExists(directory, state.host);

0 commit comments

Comments
 (0)