Alan
TTCTheo's Typesafe Cult
•Created by Alan on 6/5/2023 in #questions
Exhaustive Switch in TypeScript
I would say either yes or no. I am developing the service with some others, and I want to use the type system to check the errors. That's why I don't throw in my service and want an exhaustive switch.
note: The throw in the switch is actually throwing to tRPC, I want to use the errors returned by our service to throw different tRPC error codes.
Now we're using
ts-pattern
and I'm quite happy with that 🙂7 replies
TTCTheo's Typesafe Cult
•Created by Alan on 6/5/2023 in #questions
Exhaustive Switch in TypeScript
I can't check if my switch is exhaustive in your version, and also not able to know what are the errors that my service is going to return : (
7 replies