Creating a Maybe Type Helper
Let's go a little bit deeper into type helpers.
Looking at the tests, we can see that it expects the Maybe
type helper will returns the thing we're passing in, or null
, or undefined
.
Expect<Maybe<string>, string | null | undefined>>;Expect<Maybe<number>, number | null | undefi
Transcript
0:00 Let's go a little bit deeper into type helpers then. We have a Maybe type here and we want to make this Maybe a type helper that will, when we pass it a string, will return string or null or undefined.
0:13 That's your job, is to try and make this Maybe into a type helper that returns Maybe it's the thing you're passing. Good luck.