Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.65 KB

File metadata and controls

24 lines (18 loc) · 1.65 KB

Deep Omit medium #omit object-keys deep

by bowen @jiaowoxiaobala

Take the Challenge

Implement a typeDeepOmit, Like Utility types Omit, A type takes two arguments.

For example:

type obj = {
  person: {
    name: string;
    age: {
      value: number
    }
  }
}

type test1 = DeepOmit<obj, 'person'>    // {}
type test2 = DeepOmit<obj, 'person.name'> // { person: { age: { value: number } } }
type test3 = DeepOmit<obj, 'name'> // { person: { name: string; age: { value: number } } }
type test4 = DeepOmit<obj, 'person.age.value'> // { person: { name: string; age: {} } }

Back Share your Solutions Check out Solutions