Bug Report
🔎 Search Terms
Type Guard
🕗 Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4
⏯ Playground Link
A simple example
💻 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
Bug Report
🔎 Search Terms
Type Guard
🕗 Version & Regression Information
⏯ Playground Link
A simple example
💻 Code
🙁 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