I'm looking for a way to take a nested object type and narrow it to just the leaf keys where their value is type T
type Input = {
str: string,
other: {
int: number
},
foo: {
bar: number,
baz: string
},
}
// DeepNarrowByType<Input, string>; ???
type Output = {
str: string,
foo: {
baz: string
},
}