Function overloads with more than 1 parameter
Im trying to overload a function that the first two parameters are string and are not optional, the first parameter should be an union type of strings and the second parameter should also be a union type of strings but these should depende on the first parameter.
For example, we have the next function
where the module can be
climate
and date
and when i pass any of those have the correct possible methods.
I tried overloading the function like this:
but I end up having a union type of all the methods even though I pass certain module as a parameter.
Is there any way of fix this?1 Reply
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.