@@ -181,6 +181,7 @@ import {
181181 first,
182182 firstDefined,
183183 firstOrUndefined,
184+ firstOrUndefinedIterator,
184185 flatMap,
185186 flatten,
186187 FlowArrayMutation,
@@ -259,7 +260,6 @@ import {
259260 getEmitScriptTarget,
260261 getEnclosingBlockScopeContainer,
261262 getEntityNameFromTypeNode,
262- getEntries,
263263 getErrorSpanForNode,
264264 getEscapedTextOfIdentifierOrLiteral,
265265 getESModuleInterop,
@@ -347,8 +347,8 @@ import {
347347 hasAccessorModifier,
348348 hasAmbientModifier,
349349 hasContextSensitiveParameters,
350- hasDecorators,
351350 HasDecorators,
351+ hasDecorators,
352352 hasDynamicName,
353353 hasEffectiveModifier,
354354 hasEffectiveModifiers,
@@ -357,8 +357,8 @@ import {
357357 hasExtension,
358358 HasIllegalDecorators,
359359 HasIllegalModifiers,
360- hasInitializer,
361360 HasInitializer,
361+ hasInitializer,
362362 hasJSDocNodes,
363363 hasJSDocParameterTags,
364364 hasJsonModuleEmitEnabled,
@@ -926,7 +926,6 @@ import {
926926 stripQuotes,
927927 StructuredType,
928928 SubstitutionType,
929- sum,
930929 SuperCall,
931930 SwitchStatement,
932931 Symbol,
@@ -1180,7 +1179,7 @@ export const enum TypeFacts {
11801179 AndFactsMask = All & ~OrFactsMask,
11811180}
11821181
1183- const typeofNEFacts: ReadonlyMap<string, TypeFacts> = new Map(getEntries ({
1182+ const typeofNEFacts: ReadonlyMap<string, TypeFacts> = new Map(Object.entries ({
11841183 string: TypeFacts.TypeofNEString,
11851184 number: TypeFacts.TypeofNENumber,
11861185 bigint: TypeFacts.TypeofNEBigInt,
@@ -1301,7 +1300,7 @@ const enum IntrinsicTypeKind {
13011300 Uncapitalize
13021301}
13031302
1304- const intrinsicTypeKinds: ReadonlyMap<string, IntrinsicTypeKind> = new Map(getEntries ({
1303+ const intrinsicTypeKinds: ReadonlyMap<string, IntrinsicTypeKind> = new Map(Object.entries ({
13051304 Uppercase: IntrinsicTypeKind.Uppercase,
13061305 Lowercase: IntrinsicTypeKind.Lowercase,
13071306 Capitalize: IntrinsicTypeKind.Capitalize,
@@ -1436,9 +1435,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
14361435 // extra cost of calling `getParseTreeNode` when calling these functions from inside the
14371436 // checker.
14381437 const checker: TypeChecker = {
1439- getNodeCount: () => sum (host.getSourceFiles(), " nodeCount" ),
1440- getIdentifierCount: () => sum (host.getSourceFiles(), " identifierCount" ),
1441- getSymbolCount: () => sum (host.getSourceFiles(), "symbolCount") + symbolCount,
1438+ getNodeCount: () => reduceLeft (host.getSourceFiles(), (n, s) => n + s. nodeCount, 0 ),
1439+ getIdentifierCount: () => reduceLeft (host.getSourceFiles(), (n, s) => n + s. identifierCount, 0 ),
1440+ getSymbolCount: () => reduceLeft (host.getSourceFiles(), (n, s) => n + s. symbolCount, symbolCount) ,
14421441 getTypeCount: () => typeCount,
14431442 getInstantiationCount: () => totalInstantiationCount,
14441443 getRelationCacheSizes: () => ({
@@ -13649,7 +13648,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1364913648 isUnion &&
1365013649 (propSet || checkFlags & CheckFlags.Partial) &&
1365113650 checkFlags & (CheckFlags.ContainsPrivate | CheckFlags.ContainsProtected) &&
13652- !(propSet && getCommonDeclarationsOfSymbols(arrayFrom( propSet.values() )))
13651+ !(propSet && getCommonDeclarationsOfSymbols(propSet.values()))
1365313652 ) {
1365413653 // No property was found, or, in a union, a property has a private or protected declaration in one
1365513654 // constituent, but is missing or has a different declaration in another constituent.
@@ -13757,7 +13756,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1375713756 return property;
1375813757 }
1375913758
13760- function getCommonDeclarationsOfSymbols(symbols: readonly Symbol[] ) {
13759+ function getCommonDeclarationsOfSymbols(symbols: Iterable< Symbol> ) {
1376113760 let commonDeclarations: Set<Node> | undefined;
1376213761 for (const symbol of symbols) {
1376313762 if (!symbol.declarations) {
@@ -19009,8 +19008,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1900919008 ) {
1901019009 // Assignability failure - check each prop individually, and if that fails, fall back on the bad error span
1901119010 let reportedError = false;
19012- for (let status = iterator.next(); !status.done; status = iterator.next() ) {
19013- const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status. value;
19011+ for (const value of iterator) {
19012+ const { errorNode: prop, innerExpression: next, nameType, errorMessage } = value;
1901419013 let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType);
1901519014 if (!targetPropType || targetPropType.flags & TypeFlags.IndexedAccess) continue; // Don't elaborate on indexes on generic variables
1901619015 let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
@@ -23563,8 +23562,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2356323562 }
2356423563
2356523564 function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean): Symbol | undefined {
23566- const result = getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties).next();
23567- if (!result.done) return result.value;
23565+ return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
2356823566 }
2356923567
2357023568 function tupleTypesDefinitelyUnrelated(source: TupleTypeReference, target: TupleTypeReference) {
0 commit comments