type when comparing equality to a type that isn't a union of literal types. The rule is redundant because a primitive type is already directed- comparable to a value of that primitive type, and it causes errors to be missed when comparing a type parameter _constrained_ by a union of literal types to another union of literal types. The baseline changes look like improvements to me. Fixes #26758.
7 lines
142 B
TypeScript
7 lines
142 B
TypeScript
// Test for #26758
|
|
|
|
function foo<T extends "a" | "b">(t: T) {
|
|
t === "a"; // Should be allowed
|
|
t === "x"; // Should be error
|
|
}
|