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
Expected behavior:
Typescript recognises that the type of the action has been checked and that the action has been refined to a specific one where the payload properties can be safely accessed.
Actual behavior:
Typescript does not refine the type and it errors saying that the action could be any of the payloads specified in the union type.
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms: discriminated discrimination union destructured parameters
Code
Expected behavior:
Typescript recognises that the
type
of the action has been checked and that the action has been refined to a specific one where thepayload
properties can be safely accessed.Actual behavior:
Typescript does not refine the type and it errors saying that the
action
could be any of thepayload
s specified in the union type.Playground Link:
https://www.typescriptlang.org/play/?ssl=21&ssc=2&pln=1&pc=1#code/FAFwngDgpgBAggYxASwPYDsYF4YB8YDe40AXDAOQCGAJteQDQwSVgA2qNZRqctZ6AVwC2AIygAnAL6SYeQsShly4qENQA3KAyYt2neagBKqjYpiDRE6cGAIMAZxAwV1AQgkAhcagDWUTDgAFI6UIGYWYuKMRJBQjMxsHNSSZIgoGACU2AB8hMCysvYA7sggCAAWMIEKWQT5BQ0IlPawVLTkJPUN3c5QIALimCFhMADUOok0AHQgPLRd3U0tFCpqmh0LPbIq-YMww7AAtBN61DNGJpoLksA3Nnbojr2u7uIA6qjiPsjoAObYVQO-GEkUYlCQaHQqQhmRyeQaxVKFSq4PS6BmsVqmwKS1aNDonS23R2AyGIFCsHGqMhUwSp3OvGo2NkuJWly0hKJBRJewOMGO1IwtN0SXOxjWUGutyAA
Related Issues:
The text was updated successfully, but these errors were encountered: