Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert to old tryLoad implementation
  • Loading branch information
Andy Hanson committed Jun 1, 2016
commit 9575b3c3ca06935ab22e36d9d1dfb04b6c133bc4
10 changes: 4 additions & 6 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,13 @@ namespace ts {
onlyRecordFailures = !directoryProbablyExists(directory, state.host);
}
}
return forEach(extensions, tryLoad);

return forEach(extensions, ext => {
function tryLoad(ext: string): string {
if (state.skipTsx && (ext === ".jsx" || ext === ".tsx")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there isn't one, it would be useful to have a function to determine if the file extension is explicitly a JSX extension.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean function isJsxLike(extension: string) { return extension === ".jsx" || extension === ".tsx"; }?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not think you need the extra lambda. just revert to the old tryLoad implementation.

return;
return undefined;
}
return tryLoad(fileExtensionIs(candidate, ext) ? candidate : candidate + ext);
});

function tryLoad(fileName: string): string {
const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
if (!onlyRecordFailures && state.host.fileExists(fileName)) {
if (state.traceEnabled) {
trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
Expand Down