Fixed expando functions with symbol-only properties (#54726)

This commit is contained in:
Mateusz Burzyński
2023-07-20 22:20:47 +02:00
committed by GitHub
parent 2623fe7049
commit 5128e06a9d
9 changed files with 285 additions and 12 deletions

View File

@@ -13072,19 +13072,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return;
}
// Combinations of function, class, enum and module
let members = emptySymbols;
let members = getExportsOfSymbol(symbol);
let indexInfos: IndexInfo[] | undefined;
if (symbol.exports) {
members = getExportsOfSymbol(symbol);
if (symbol === globalThisSymbol) {
const varsOnly = new Map<__String, Symbol>();
members.forEach(p => {
if (!(p.flags & SymbolFlags.BlockScoped) && !(p.flags & SymbolFlags.ValueModule && p.declarations?.length && every(p.declarations, isAmbientModule))) {
varsOnly.set(p.escapedName, p);
}
});
members = varsOnly;
}
if (symbol === globalThisSymbol) {
const varsOnly = new Map<__String, Symbol>();
members.forEach(p => {
if (!(p.flags & SymbolFlags.BlockScoped) && !(p.flags & SymbolFlags.ValueModule && p.declarations?.length && every(p.declarations, isAmbientModule))) {
varsOnly.set(p.escapedName, p);
}
});
members = varsOnly;
}
let baseConstructorIndexInfo: IndexInfo | undefined;
setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);