Incorrect type inference with discriminated unions.
Hey folks, I am having a really weird issue.
Here is a minimal reproducible example: https://tsplay.dev/WJB1kW
Basically I have a function that returns an object of the
I have created a router and a procedure that returns the result of
However, I am getting a type error:
Any idea how to solve this issue?
Here is a minimal reproducible example: https://tsplay.dev/WJB1kW
Basically I have a function that returns an object of the
Difference, which is a union of 3 other types:I have created a router and a procedure that returns the result of
myFunction. I then call this function on the client like this:However, I am getting a type error:
Any idea how to solve this issue?
A link shortener for the TypeScript Playground
Solution
GitHub
Provide environment information System: OS: Linux 6.5 Linux Mint 21.2 (Victoria) CPU: (24) x64 AMD Ryzen 9 7900 12-Core Processor Memory: 24.78 GB / 30.53 GB Container: Yes Shell: 5.8.1 - /bin/zsh ...