2020-07-26 08:03:02 +08:00
..
2020-07-25 19:31:31 +08:00
2020-07-25 19:31:31 +08:00
2020-07-26 08:03:02 +08:00
2020-07-25 19:31:31 +08:00

Omit<T, K> medium #union #built-in

by Anthony Fu @antfu

Take the Challenge

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

Constructs a type by picking all properties from T and then removing K

For example

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

type TodoPreview = MyOmit<Todo, 'description'>

const todo: TodoPreview = {
  title: 'Clean room',
  completed: false,
}
Back Check out Solutions Share your Solutions