Approaches for Typing Object Parameters
Consider this implementation of returnBothOfWhatIPassIn
:
This time the function takes in a params
object that includes a
and b
.
Transcript
0:00 We have another function here called returnBothOfWhatIPassIn, where we're taking this time as a params object, where you need to pass in an object where A is A and B is B. It's expecting to infer just exactly the same as the previous exercise where you have first as string and second as number.
0:19 A is being passed to first and B is being passed to second. Your job is to work out how to type this using generic syntax.