Closed as not planned
Description
π Search Terms
This comparison appears to be unintentional because the types '"yes"' and '"no"' have no overlap.(2367)
π Version & Regression Information
This reproduces also in TS 5.6, 5.5.
β― Playground Link
π» Code
class Foo {
entitlement: 'yes' | 'no' = 'yes'
}
class Bar {
private foo = new Foo()
get entitlement() {
return this.foo.entitlement;
}
bar() {
if (this.entitlement === 'yes') {
this.foo.entitlement = 'no';
if (this.entitlement === 'no') {
//^^^^^^^This comparison appears to be unintentional because the types '"yes"' and '"no"' have no overlap.(2367)
}
console.log(this.entitlement);
}
}
}
const bar = new Bar();
bar.bar();
π Actual behavior
The check in line 16 (if (this.entitlement === 'no') {
) produces a compile error:
This comparison appears to be unintentional because the types '"yes"' and '"no"' have no overlap.(2367)
π Expected behavior
The check in line 16 (if (this.entitlement === 'no') {
) does not produce a compile error.
Additional information about the issue
No response