Get Return Type with Rob Meyer - TypeScript Type Challenges #2 [MEDIUM]

Опубликовано: 03 Ноябрь 2024
на канале: Michigan TypeScript
953
36

This challenge is a reimplementation of one of the most useful TypeScript builtins: ReturnType. This type allows you to extract the return type of a function. It touches on how to use the `infer` keyword, which we're going to find ourselves frequently consulting in the near future!

00:00 description of the challenge
01:26 attempt at a solution
03:06 all tests pass
04:31 alternatives
05:22 attempts that didn't work

You can view the code for this challenge on GitHub: https://github.com/type-challenges/ty.... You can also view the umbrella issue with code for all the challenges we've solved here: https://github.com/type-challenges/ty...

A new challenge posts every day from January 1st 2023 to May 20th 2023. If you’d like to join in solving them, please email us at: [email protected]

Discord:   / discord  
Twitter:   / mitypescript  
Mastodon: https://fosstodon.org/@MichiganTypeSc...
Instagram:   / michigantypescript  
TikTok:   / michigantypescript