Skip to content

Commit 15eda09

Browse files
committed
drop unused code
1 parent a390703 commit 15eda09

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14667,23 +14667,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1466714667
inferredProp.declarations = prop.declarations;
1466814668
inferredProp.links.nameType = getSymbolLinks(prop).nameType;
1466914669
inferredProp.links.propertyType = getTypeOfSymbol(prop);
14670-
if (
14671-
type.constraintType.type.flags & TypeFlags.IndexedAccess
14672-
&& (type.constraintType.type as IndexedAccessType).objectType.flags & TypeFlags.TypeParameter
14673-
&& (type.constraintType.type as IndexedAccessType).indexType.flags & TypeFlags.TypeParameter
14674-
) {
14675-
// A reverse mapping of `{[K in keyof T[K_1]]: T[K_1]}` is the same as that of `{[K in keyof T]: T}`, since all we care about is
14676-
// inferring to the "type parameter" (or indexed access) shared by the constraint and template. So, to reduce the number of
14677-
// type identities produced, we simplify such indexed access occurences
14678-
const newTypeParam = (type.constraintType.type as IndexedAccessType).objectType;
14679-
const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type as ReplaceableIndexedAccessType, newTypeParam);
14680-
inferredProp.links.mappedType = newMappedType as MappedType;
14681-
inferredProp.links.constraintType = getIndexType(newTypeParam) as IndexType;
14682-
}
14683-
else {
14684-
inferredProp.links.mappedType = type.mappedType;
14685-
inferredProp.links.constraintType = type.constraintType;
14686-
}
14670+
inferredProp.links.mappedType = type.mappedType;
14671+
inferredProp.links.constraintType = type.constraintType;
1468714672
members.set(prop.escapedName, inferredProp);
1468814673
}
1468914674
setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
@@ -26381,6 +26366,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2638126366
* variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for).
2638226367
*/
2638326368
function inferTypeForHomomorphicMappedType(source: Type, target: MappedType, constraint: IndexType): Type | undefined {
26369+
// A reverse mapping of `{[K in keyof T[K_1]]: T[K_1]}` is the same as that of `{[K in keyof T]: T}`, since all we care about is
26370+
// inferring to the "type parameter" (or indexed access) shared by the constraint and template. So, to reduce the number of
26371+
// type identities produced, we simplify such indexed access occurences
2638426372
if (constraint.type.flags & TypeFlags.IndexedAccess) {
2638526373
const newTypeParam = (constraint.type as IndexedAccessType).objectType;
2638626374
target = replaceIndexedAccess(target, constraint.type as ReplaceableIndexedAccessType, newTypeParam) as MappedType;

0 commit comments

Comments
 (0)