@@ -25215,9 +25215,8 @@ namespace ts {
25215
25215
if (forceTuple || inConstContext || contextualType && forEachType(contextualType, isTupleLikeType)) {
25216
25216
return createArrayLiteralType(createTupleType(elementTypes, elementFlags, /*readonly*/ inConstContext));
25217
25217
}
25218
- const deduplicatedTypes = deduplicateObjectOrArrayLiteralTypes(sameMap(elementTypes, (t, i) => elementFlags[i] & ElementFlags.Variadic ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t));
25219
25218
return createArrayLiteralType(createArrayType(elementTypes.length ?
25220
- getUnionType(deduplicatedTypes , UnionReduction.Subtype) :
25219
+ getUnionType(sameMap(elementTypes, (t, i) => elementFlags[i] & ElementFlags.Variadic ? getIndexedAccessTypeOrUndefined(t, numberType) || anyType : t) , UnionReduction.Subtype) :
25221
25220
strictNullChecks ? implicitNeverType : undefinedWideningType, inConstContext));
25222
25221
}
25223
25222
@@ -25233,48 +25232,6 @@ namespace ts {
25233
25232
return literalType;
25234
25233
}
25235
25234
25236
- /**
25237
- * Replaces all references to structurally equivalent object and array literal types in the given list
25238
- * with references to a single one of those types. The process is applied recursively to properties of
25239
- * object literals and elements of array literals.
25240
- */
25241
- function deduplicateObjectOrArrayLiteralTypes(types: Type[]) {
25242
- if (!some(types, isObjectOrArrayLiteralType)) {
25243
- return types;
25244
- }
25245
- const typeMap = new Map<string, Type>();
25246
- return sameMap(types, getInternedType);
25247
-
25248
- function getInternedType(type: Type): Type {
25249
- if (type.flags & TypeFlags.Union) {
25250
- const newTypes = sameMap((<UnionType>type).types, getInternedType);
25251
- return newTypes !== (<UnionType>type).types ? getUnionType(newTypes) : type;
25252
- }
25253
- const key = getLiteralTypeKey(type);
25254
- return key ? typeMap.get(key) || (typeMap.set(key, type), type) : type;
25255
- }
25256
-
25257
- function getLiteralTypeKey(type: Type): string | undefined {
25258
- const objectFlags = getObjectFlags(type);
25259
- if (objectFlags & ObjectFlags.ObjectLiteral) {
25260
- const props = getPropertiesOfObjectType(type);
25261
- const propTypes = map(props, p => getInternedType(getTypeOfSymbol(p)));
25262
- const nameLengths = map(props, p => p.flags & SymbolFlags.Optional ? -(<string>p.escapedName).length : (<string>p.escapedName).length);
25263
- const nameStrings = map(props, p => <string>p.escapedName);
25264
- return `${getTypeListId(propTypes)}|${nameLengths.join(",")}|${nameStrings.join("")}`;
25265
- }
25266
- if (objectFlags & ObjectFlags.ArrayLiteral) {
25267
- if (isArrayType(type)) {
25268
- return `${isReadonlyArrayType(type) ? "R" : "A"}${getTypeId(getInternedType(getTypeArguments(type)[0]))}`;
25269
- }
25270
- if (isTupleType(type)) {
25271
- return `T${getTypeId(type.target)}|${getTypeListId(sameMap(getTypeArguments(type), getInternedType))}`;
25272
- }
25273
- }
25274
- return undefined;
25275
- }
25276
- }
25277
-
25278
25235
function isNumericName(name: DeclarationName): boolean {
25279
25236
switch (name.kind) {
25280
25237
case SyntaxKind.ComputedPropertyName:
0 commit comments