@@ -13488,7 +13488,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1348813488
1348913489 // If we have a generator already, pick up where we left off.
1349013490 // Otherwise, we haven't started, so create a new one.
13491- const generator = type.partiallyResolvedPropertiesGenerator ??= worker( );
13491+ const generator = type.partiallyResolvedPropertiesGenerator ??= iteratePropertiesOfUnionOrIntersectionTypeWorker(type );
1349213492 for (const symbol of generator) {
1349313493 type.partiallyResolvedProperties = append(type.partiallyResolvedProperties, symbol);
1349413494 if (doYield) {
@@ -13499,26 +13499,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1349913499 type.resolvedProperties = type.partiallyResolvedProperties ?? emptyArray;
1350013500 type.partiallyResolvedProperties = undefined;
1350113501 type.partiallyResolvedPropertiesGenerator = undefined;
13502+ }
1350213503
13503- function* worker() {
13504- const seenSymbols = new Set<__String>();
13505- for (const current of type.types) {
13506- for (const prop of getPropertiesOfType(current)) {
13507- if (!seenSymbols.has(prop.escapedName)) {
13508- const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
13509- if (combinedProp) {
13510- seenSymbols.add(prop.escapedName);
13511- if (isNamedMember(combinedProp, prop.escapedName)) {
13512- yield combinedProp;
13513- }
13504+ function* iteratePropertiesOfUnionOrIntersectionTypeWorker(type: UnionOrIntersectionType) {
13505+ const seenSymbols = new Set<__String>();
13506+ for (const current of type.types) {
13507+ for (const prop of getPropertiesOfType(current)) {
13508+ if (!seenSymbols.has(prop.escapedName)) {
13509+ const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
13510+ if (combinedProp) {
13511+ seenSymbols.add(prop.escapedName);
13512+ if (isNamedMember(combinedProp, prop.escapedName)) {
13513+ yield combinedProp;
1351413514 }
1351513515 }
1351613516 }
13517- // The properties of a union type are those that are present in all constituent types, so
13518- // we only need to check the properties of the first type without index signature
13519- if (type.flags & TypeFlags.Union && getIndexInfosOfType(current).length === 0) {
13520- break;
13521- }
13517+ }
13518+ // The properties of a union type are those that are present in all constituent types, so
13519+ // we only need to check the properties of the first type without index signature
13520+ if (type.flags & TypeFlags.Union && getIndexInfosOfType(current).length === 0) {
13521+ break;
1352213522 }
1352313523 }
1352413524 }
0 commit comments