Skip to content

Commit

Permalink
Reuse getSimplifiedTypeOrConstraint function
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed May 23, 2019
1 parent b7012b5 commit cd7a14a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/compiler/checker.ts
Expand Up @@ -13066,8 +13066,7 @@ namespace ts {
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
const simplified = getSimplifiedType((<IndexType>target).type, /*writing*/ false);
const constraint = simplified !== (<IndexType>target).type ? simplified : getConstraintOfType((<IndexType>target).type);
const constraint = getSimplifiedTypeOrConstraint((<IndexType>target).type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
Expand Down

0 comments on commit cd7a14a

Please sign in to comment.