Closed as not planned
Description
π Search Terms
type guard, type refinement, typescript 5.4.3
π Version & Regression Information
- This changed between versions 5.4.2 and 5.4.3
β― Playground Link
π» Code
type W = { readonly type: 'a'; b: number };
type Z = { readonly type: 'b'; c: string };
type X = W | Z;
declare const x: X;
const isA = (type: 'a' | 'b'): type is 'a' => type === 'a';
if (isA(x.type)) {
x.b; // x has a type X instead of W
}
π Actual behavior
the x
has the wider type X
π Expected behavior
x
has the concrete type W
Additional information about the issue
No response