mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
Pick<T, K>

by Anthony Fu @antfu
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,
}