Open
Description
Bug Report
π Search Terms
Type Guard
π Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4
β― Playground Link
π» Code
declare class Foo<Stuff extends boolean> {
stuff: Stuff extends true ? string : string | undefined;
isReady(): this is Foo<true>
}
declare const x: Foo<boolean>;
if(x.isReady()) {
x
//^? - const x: Foo<boolean>
// Should be Foo<true>
}
π Actual behavior
The Type Guard didn't change the type, which is unintuitive behavior.
π Expected behavior
The method should act as a type guard and change the type