Narrowing Function Result in TypeScript for Specific Routes
Ok so i have a typescript problem where i'm trying to narrow this function result.
I have a
The call site looks like this:
Basically, i want to narrow based on the parameter i pass in - so that in my handler it narrows the result to just one of the types instead of the union that
I have a
get function like so:route is typed as Routes which is a union of strings that a route can be.The call site looks like this:
Basically, i want to narrow based on the parameter i pass in - so that in my handler it narrows the result to just one of the types instead of the union that
get says it can return.