Refactor named imports to default instead of namespace when esModuleInterop is on and module is an export= (#47744)

This commit is contained in:
Andrew Branch
2022-02-04 17:11:25 -08:00
committed by GitHub
parent 8ddead50eb
commit 9c3b41d3cc
4 changed files with 115 additions and 36 deletions

View File

@@ -1252,11 +1252,11 @@ namespace ts {
return result;
}
export function getOwnValues<T>(sparseArray: T[]): T[] {
export function getOwnValues<T>(collection: MapLike<T> | T[]): T[] {
const values: T[] = [];
for (const key in sparseArray) {
if (hasOwnProperty.call(sparseArray, key)) {
values.push(sparseArray[key]);
for (const key in collection) {
if (hasOwnProperty.call(collection, key)) {
values.push((collection as MapLike<T>)[key]);
}
}

View File

@@ -7123,6 +7123,10 @@
"category": "Message",
"code": 95169
},
"Convert named imports to default import": {
"category": "Message",
"code": 95170
},
"No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": {
"category": "Error",