Disclosure
Most of the problems under my TypeHero Challenges folder were either obtained from typehero.dev or from type-challenges repo. Purpose of these articles are just to document my approaches for my easy reference. Please visit the respective links for more info.
Link to original
Problem Description
Pick
is a special built-in TypeScript type that’s always in scope, so you don’t need to import it from anywhere. You can just use it as-if it was already imported.
To use it, you must provide Pick
with two things:
- The type original object you’re basing your new type on (in our example,
Pokemon
) - A union of strings representing all the keys you wish to pick from the base type (in our case,
name
andtype
).
In this challenge you’ll implement the Pick
type described above.