-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Closed as not planned
Copy link
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
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
whzx5byb
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created