@@ -4397,8 +4397,8 @@ namespace ts {
4397
4397
context.inferTypeParameters = (<ConditionalType>type).root.inferTypeParameters;
4398
4398
const extendsTypeNode = typeToTypeNodeHelper((<ConditionalType>type).extendsType, context);
4399
4399
context.inferTypeParameters = saveInferTypeParameters;
4400
- const trueTypeNode = typeToTypeNodeOrCircularityElision (getTrueTypeFromConditionalType(<ConditionalType>type));
4401
- const falseTypeNode = typeToTypeNodeOrCircularityElision (getFalseTypeFromConditionalType(<ConditionalType>type));
4400
+ const trueTypeNode = typeToTypeNodeHelper (getTrueTypeFromConditionalType(<ConditionalType>type), context );
4401
+ const falseTypeNode = typeToTypeNodeHelper (getFalseTypeFromConditionalType(<ConditionalType>type), context );
4402
4402
context.approximateLength += 15;
4403
4403
return createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
4404
4404
}
@@ -4408,21 +4408,6 @@ namespace ts {
4408
4408
4409
4409
return Debug.fail("Should be unreachable.");
4410
4410
4411
-
4412
- function typeToTypeNodeOrCircularityElision(type: Type) {
4413
- if (type.flags & TypeFlags.Union) {
4414
- if (context.visitedTypes && context.visitedTypes.has("" + getTypeId(type))) {
4415
- if (!(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier)) {
4416
- context.encounteredError = true;
4417
- context.tracker?.reportCyclicStructureError?.();
4418
- }
4419
- return createElidedInformationPlaceholder(context);
4420
- }
4421
- return visitAndTransformType(type, type => typeToTypeNodeHelper(type, context));
4422
- }
4423
- return typeToTypeNodeHelper(type, context);
4424
- }
4425
-
4426
4411
function createMappedTypeNodeFromType(type: MappedType) {
4427
4412
Debug.assert(!!(type.flags & TypeFlags.Object));
4428
4413
const readonlyToken = type.declaration.readonlyToken ? <ReadonlyToken | PlusToken | MinusToken>createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -12809,12 +12794,10 @@ namespace ts {
12809
12794
return links.resolvedType;
12810
12795
}
12811
12796
12812
- function createIndexedAccessType(objectType: Type, indexType: Type, aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined ) {
12797
+ function createIndexedAccessType(objectType: Type, indexType: Type) {
12813
12798
const type = <IndexedAccessType>createType(TypeFlags.IndexedAccess);
12814
12799
type.objectType = objectType;
12815
12800
type.indexType = indexType;
12816
- type.aliasSymbol = aliasSymbol;
12817
- type.aliasTypeArguments = aliasTypeArguments;
12818
12801
return type;
12819
12802
}
12820
12803
@@ -13146,11 +13129,11 @@ namespace ts {
13146
13129
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
13147
13130
}
13148
13131
13149
- function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[] ): Type {
13150
- return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, AccessFlags.None, aliasSymbol, aliasTypeArguments ) || (accessNode ? errorType : unknownType);
13132
+ function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression): Type {
13133
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, AccessFlags.None) || (accessNode ? errorType : unknownType);
13151
13134
}
13152
13135
13153
- function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[] ): Type | undefined {
13136
+ function getIndexedAccessTypeOrUndefined(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, accessFlags = AccessFlags.None): Type | undefined {
13154
13137
if (objectType === wildcardType || indexType === wildcardType) {
13155
13138
return wildcardType;
13156
13139
}
@@ -13172,7 +13155,7 @@ namespace ts {
13172
13155
const id = objectType.id + "," + indexType.id;
13173
13156
let type = indexedAccessTypes.get(id);
13174
13157
if (!type) {
13175
- indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, aliasSymbol, aliasTypeArguments ));
13158
+ indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType));
13176
13159
}
13177
13160
return type;
13178
13161
}
@@ -13200,7 +13183,7 @@ namespace ts {
13200
13183
if (wasMissingProp) {
13201
13184
return undefined;
13202
13185
}
13203
- return accessFlags & AccessFlags.Writing ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments ) : getUnionType(propTypes, UnionReduction.Literal, aliasSymbol, aliasTypeArguments );
13186
+ return accessFlags & AccessFlags.Writing ? getIntersectionType(propTypes) : getUnionType(propTypes);
13204
13187
}
13205
13188
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | AccessFlags.CacheSymbol);
13206
13189
}
@@ -13210,8 +13193,7 @@ namespace ts {
13210
13193
if (!links.resolvedType) {
13211
13194
const objectType = getTypeFromTypeNode(node.objectType);
13212
13195
const indexType = getTypeFromTypeNode(node.indexType);
13213
- const potentialAlias = getAliasSymbolForTypeNode(node);
13214
- const resolved = getIndexedAccessType(objectType, indexType, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
13196
+ const resolved = getIndexedAccessType(objectType, indexType, node);
13215
13197
links.resolvedType = resolved.flags & TypeFlags.IndexedAccess &&
13216
13198
(<IndexedAccessType>resolved).objectType === objectType &&
13217
13199
(<IndexedAccessType>resolved).indexType === indexType ?
@@ -14359,7 +14341,7 @@ namespace ts {
14359
14341
return getIndexType(instantiateType((<IndexType>type).type, mapper));
14360
14342
}
14361
14343
if (flags & TypeFlags.IndexedAccess) {
14362
- return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper), /*accessNode*/ undefined, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper) );
14344
+ return getIndexedAccessType(instantiateType((<IndexedAccessType>type).objectType, mapper), instantiateType((<IndexedAccessType>type).indexType, mapper));
14363
14345
}
14364
14346
if (flags & TypeFlags.Conditional) {
14365
14347
return getConditionalTypeInstantiation(<ConditionalType>type, combineTypeMappers((<ConditionalType>type).mapper, mapper));
0 commit comments