Is it possible for TypeScript to recursively infer the type of an object's keys and its children's keys? Consider the following scenario:
const o:A<X> = {
a:'1',
b: {
c: '2'
}
}
If we define A
so that X
is "a"|"b"|"c"
, TypeScript can currently only infer the first layer (i.e. X = "a"|"b"
) using keyof
. How can we make TypeScript infer the key types of the grandchildren nodes as well?