Intro to Generics 9 exercises
Problem

Typing Independent Parameters

This exercise begins with a returnBothOfWhatIPassIn function:


const returnBothOfWhatIPassIn = (a: unknown, b: unknown) => {
return {
a,
b,
};
};

It takes two arguments a and b that are currently typed as unknown and returned inside of an object.

Challenge

Loading exercise

Transcript

0:00 In this exercise, we have a returnBothOfWhatIPassIn function. What this does is it takes two arguments here, and we have an a here and 1. This should be typed as a is a and b is 1 here because that's the slots that are coming through here.

0:17 Currently, it's just typed as an object with two unknowns in. Your job is to try and figure out how we can manipulate the syntax we already know to try and get these two independent things in third in the object that's returned.