import statement from "node" in js source file could produce correct declaration path. (#41816)

* fix #41800

* add test

* fix test
This commit is contained in:
Song Gao
2020-12-07 21:54:47 +08:00
committed by GitHub
parent bf977ed918
commit 37e898cfd7
5 changed files with 139 additions and 1 deletions

View File

@@ -1422,7 +1422,8 @@ namespace ts {
export function getPackageNameFromTypesPackageName(mangledName: string): string {
const withoutAtTypePrefix = removePrefix(mangledName, "@types/");
if (withoutAtTypePrefix !== mangledName) {
return unmangleScopedPackageName(withoutAtTypePrefix);
const withoutAtTypeNodePrefix = removePrefix(withoutAtTypePrefix, "node/");
return unmangleScopedPackageName(withoutAtTypeNodePrefix);
}
return mangledName;
}