You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeW={readonlytype: 'a';b: number};typeZ={readonlytype: 'b';c: string};typeX=W|Z;declareconstx: X;constisA=(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
The text was updated successfully, but these errors were encountered:
π Search Terms
type guard, type refinement, typescript 5.4.3
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBA6lC8UDeUBOECGATA9gOwBsQpRIAuKAcg0oG4oAjCvAVwFsGJUoBfWgKFLQAWgmRpMuQsSEVKDOlADGFAM7BUASzwBzXgKFQAGmLgAfKMIH8sEJQQzpl+dVAAeFI9aUvgUTaoAgmIAFLJUNFAW8pQAlBSGARGUCAB8JODQ8NnJ1poAZlAhAYEhbgB0QrGxyPxQ7uUM9AD0ze5QABYYqlAYGZDG-njqklA4hTD8PEA
π» Code
π Actual behavior
the
x
has the wider typeX
π Expected behavior
x
has the concrete typeW
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: