Skip to content

Commit 375437e

Browse files
Avoid checking for optionality in comparability checks.
1 parent 2edabe0 commit 375437e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7331,7 +7331,8 @@ namespace ts {
73317331
return Ternary.False;
73327332
}
73337333
result &= related;
7334-
if (sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
7334+
// When checking for comparability, be more lenient with optional properties.
7335+
if (relation !== comparableRelation && sourceProp.flags & SymbolFlags.Optional && !(targetProp.flags & SymbolFlags.Optional)) {
73357336
// TypeScript 1.0 spec (April 2014): 3.8.3
73367337
// S is a subtype of a type T, and T is a supertype of S if ...
73377338
// S' and T are object types and, for each member M in T..

0 commit comments

Comments
 (0)