Skip to content

Files

Latest commit

eddde5d · Jul 6, 2022

History

History
This branch is 248 commits behind type-challenges/type-challenges:main.

00004-easy-pick

Pick easy #union #built-in

by Anthony Fu @antfu

Take the Challenge    简体中文 日本語 한국어

Implement the built-in Pick<T, K> generic without using it.

Constructs a type by picking the set of properties K from T

For example:

interface Todo {
  title: string
  description: string
  completed: boolean
}

type TodoPreview = MyPick<Todo, 'title' | 'completed'>

const todo: TodoPreview = {
    title: 'Clean room',
    completed: false,
}

Back Share your Solutions Check out Solutions

Related Challenges

3・Omit