Found a stack overflow post with what I want to achieve.
https://stackoverflow.com/questions/67884720/typescript-omit-nested-property
But I'm not a fan of how this answer is supposed to be used.
https://stackoverflow.com/a/67888086
I'd prefer if it worked like the built in Omit utility type, so lets say
type MyType = {
foo: {
bar: string;
fizz: number;
buzz: boolean;
}
}
type FooWithBar = Omit<MyType, 'foo.fizz' | 'foo.buzz'>
// ^? { foo: { bar: string; } }