2020-07-31 17:50:09 +08:00
..
2020-07-31 17:50:09 +08:00
2020-07-25 19:31:31 +08:00
2020-07-31 17:50:09 +08:00
2020-07-25 19:31:31 +08:00

Pick<T, K> 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 T from K

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<T, K>