Typing response based on request params
Hi!
I'm trying to figure out if there's a way to type the response based on request param in a way that will make it easy later for TS to figure out the correct response type.
What I have so far is:
Now, this is a slightly simplified version and it works, but I'm wondering what's the easiest way to later narrow the actual response type based on the actual
os
value.
If I do something like:
Is it possible? Should it "just" work? Is there some way to make it work without casting data
manually using data as Response<'android'>
?0 Replies