I'm trying to type partial objects from GraphQL queries. In particular, I'm having trouble with an object similar to as follows ...
// Typescript types
interface Foo {
bar: Bar
}
interface Bar {
a: number,
b: number
}
// GrapQL query
foo {
bar {
a
// Note missing 'b' property
}
}
When I pcome to type this response I can use Pick on the Bar property, but this then violates Foos declaration. I could create an entire new type but in my actual axample both Foo and Bar are complex objects - is there an easier way to type the result? How do people normally type GraphQL results?