Skip to content

Commit 79c6048

Browse files
committed
Use intersectTypes instead of filterType
1 parent 7bbd299 commit 79c6048

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13201,7 +13201,7 @@ namespace ts {
1320113201
const targetConstraint = getConstraintTypeFromMappedType(target);
1320213202
const sourceKeys = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
1320313203
const includeOptional = modifiers & MappedTypeModifiers.IncludeOptional;
13204-
const filteredByApplicability = includeOptional ? filterType(getLiteralTypeFromProperties(target, TypeFlags.StringOrNumberLiteralOrUnique), t => !!isRelatedTo(t, sourceKeys)) : undefined;
13204+
const filteredByApplicability = includeOptional ? intersectTypes(targetConstraint, sourceKeys) : undefined;
1320513205
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
1320613206
// A source type T is related to a target type { [P in Q]?: X } if some constituent Q' of Q is related to keyof T and T[Q'] is related to X.
1320713207
if (includeOptional

0 commit comments

Comments
 (0)