@@ -181,6 +181,7 @@ import {
181
181
first,
182
182
firstDefined,
183
183
firstOrUndefined,
184
+ firstOrUndefinedIterator,
184
185
flatMap,
185
186
flatten,
186
187
FlowArrayMutation,
@@ -259,7 +260,6 @@ import {
259
260
getEmitScriptTarget,
260
261
getEnclosingBlockScopeContainer,
261
262
getEntityNameFromTypeNode,
262
- getEntries,
263
263
getErrorSpanForNode,
264
264
getEscapedTextOfIdentifierOrLiteral,
265
265
getESModuleInterop,
@@ -347,8 +347,8 @@ import {
347
347
hasAccessorModifier,
348
348
hasAmbientModifier,
349
349
hasContextSensitiveParameters,
350
- hasDecorators,
351
350
HasDecorators,
351
+ hasDecorators,
352
352
hasDynamicName,
353
353
hasEffectiveModifier,
354
354
hasEffectiveModifiers,
@@ -357,8 +357,8 @@ import {
357
357
hasExtension,
358
358
HasIllegalDecorators,
359
359
HasIllegalModifiers,
360
- hasInitializer,
361
360
HasInitializer,
361
+ hasInitializer,
362
362
hasJSDocNodes,
363
363
hasJSDocParameterTags,
364
364
hasJsonModuleEmitEnabled,
@@ -926,7 +926,6 @@ import {
926
926
stripQuotes,
927
927
StructuredType,
928
928
SubstitutionType,
929
- sum,
930
929
SuperCall,
931
930
SwitchStatement,
932
931
Symbol,
@@ -1180,7 +1179,7 @@ export const enum TypeFacts {
1180
1179
AndFactsMask = All & ~OrFactsMask,
1181
1180
}
1182
1181
1183
- const typeofNEFacts: ReadonlyMap<string, TypeFacts> = new Map(getEntries ({
1182
+ const typeofNEFacts: ReadonlyMap<string, TypeFacts> = new Map(Object.entries ({
1184
1183
string: TypeFacts.TypeofNEString,
1185
1184
number: TypeFacts.TypeofNENumber,
1186
1185
bigint: TypeFacts.TypeofNEBigInt,
@@ -1301,7 +1300,7 @@ const enum IntrinsicTypeKind {
1301
1300
Uncapitalize
1302
1301
}
1303
1302
1304
- const intrinsicTypeKinds: ReadonlyMap<string, IntrinsicTypeKind> = new Map(getEntries ({
1303
+ const intrinsicTypeKinds: ReadonlyMap<string, IntrinsicTypeKind> = new Map(Object.entries ({
1305
1304
Uppercase: IntrinsicTypeKind.Uppercase,
1306
1305
Lowercase: IntrinsicTypeKind.Lowercase,
1307
1306
Capitalize: IntrinsicTypeKind.Capitalize,
@@ -1436,9 +1435,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1436
1435
// extra cost of calling `getParseTreeNode` when calling these functions from inside the
1437
1436
// checker.
1438
1437
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) ,
1442
1441
getTypeCount: () => typeCount,
1443
1442
getInstantiationCount: () => totalInstantiationCount,
1444
1443
getRelationCacheSizes: () => ({
@@ -13649,7 +13648,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
13649
13648
isUnion &&
13650
13649
(propSet || checkFlags & CheckFlags.Partial) &&
13651
13650
checkFlags & (CheckFlags.ContainsPrivate | CheckFlags.ContainsProtected) &&
13652
- !(propSet && getCommonDeclarationsOfSymbols(arrayFrom( propSet.values() )))
13651
+ !(propSet && getCommonDeclarationsOfSymbols(propSet.values()))
13653
13652
) {
13654
13653
// No property was found, or, in a union, a property has a private or protected declaration in one
13655
13654
// constituent, but is missing or has a different declaration in another constituent.
@@ -13757,7 +13756,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
13757
13756
return property;
13758
13757
}
13759
13758
13760
- function getCommonDeclarationsOfSymbols(symbols: readonly Symbol[] ) {
13759
+ function getCommonDeclarationsOfSymbols(symbols: Iterable< Symbol> ) {
13761
13760
let commonDeclarations: Set<Node> | undefined;
13762
13761
for (const symbol of symbols) {
13763
13762
if (!symbol.declarations) {
@@ -19009,8 +19008,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
19009
19008
) {
19010
19009
// Assignability failure - check each prop individually, and if that fails, fall back on the bad error span
19011
19010
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;
19014
19013
let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType);
19015
19014
if (!targetPropType || targetPropType.flags & TypeFlags.IndexedAccess) continue; // Don't elaborate on indexes on generic variables
19016
19015
let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
@@ -23563,8 +23562,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
23563
23562
}
23564
23563
23565
23564
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));
23568
23566
}
23569
23567
23570
23568
function tupleTypesDefinitelyUnrelated(source: TupleTypeReference, target: TupleTypeReference) {
0 commit comments