Try file if matched pattern specifies the extension instead of all the time (#42246)

* Test case for path mapping with extension

* Try file if matched pattern specifies the extension instead of all the time
Fixes #39743
This commit is contained in:
Sheetal Nandi
2021-01-08 12:03:29 -08:00
committed by GitHub
parent 055f363fba
commit d36df0dda5
16 changed files with 384 additions and 7 deletions

View File

@@ -1377,7 +1377,7 @@ namespace ts {
trace(state.host, Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path);
}
// A path mapping may have an extension, in contrast to an import, which should omit it.
const extension = tryGetExtensionFromPath(candidate);
const extension = tryGetExtensionFromPath(subst);
if (extension !== undefined) {
const path = tryFile(candidate, onlyRecordFailures, state);
if (path !== undefined) {