#Omit nested property

5 messages · Page 1 of 1 (latest)

wicked falcon
steady ginkgo
#

this is imo the best way to achieve this

#

you could also manipulate the type, decomposite ,use a bunch of Omit and Partial, then recompose it
but it isn't as scalable as the accepted answer

wicked falcon
#

yes, but is there a way to get this type of interface with the utility type, so that I don't have to parse and array of keys as the second generic

talking about this

type FooWithBar = Omit<MyType, ['foo.fizz', 'foo.buzz']>;

vs this

type FooWithBar = Omit<MyType, 'foo.fizz' | 'foo.buzz'>;
dim gorge
#

I understand the idea but it can't be implemented as such.

let a = { "foo.bar": 12 }``` and 
```ts
let b = { foo: { bar: 12 } }``` are two different objects.