Skip to content

Commit 53f60d1

Browse files
committed
Fix bools, leave todo
1 parent 629de0d commit 53f60d1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28247,7 +28247,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2824728247
// if they're not equal then they're not related and we can skip doing a bunch of work.
2824828248
if (t.flags & TypeFlags.Literal && (t.flags & TypeFlags.Literal) === (c.flags & TypeFlags.Literal)) {
2824928249
if (t.flags & TypeFlags.BooleanLiteral) {
28250-
return t === c ? t : neverType;
28250+
const tIsTrue = t === trueType || t === regularTrueType;
28251+
const cIsTrue = c === trueType || c === regularTrueType;
28252+
return tIsTrue === cIsTrue ? t : neverType;
2825128253
}
2825228254
return (t as LiteralType).value === (c as LiteralType).value ? t : neverType;
2825328255
}
@@ -28256,6 +28258,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2825628258
if (isTypeStrictSubtypeOf(c, t)) return c;
2825728259

2825828260
// Strict subtyping is equivalent to subtyping for these types (and likely others).
28261+
// TODO(jakebailey): what other things can we quickly check here?
2825928262
if (t.flags & TypeFlags.Unit && c.flags & TypeFlags.Unit) return neverType;
2826028263

2826128264
if (isTypeSubtypeOf(t, c)) return t;

0 commit comments

Comments
 (0)