You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intended outcome:
With interface types, the codegen fails to produce the expected hierarchy of types.
For example:
GraphQL Schema
interface Auto {
wheelCount: Int
}
type Car implements Auto {
wheelCount: Int
name?: String!
}
type Truck implements Auto {
wheelCount: Int
bedSize: Int!
}
Queries
// Top-level query
query GetAutos {
autos {
wheelCount
}
}
// Specific query
query GetCars {
autos {
wheelCount
... on Car {
name
}
}
}
@JakeDawkins When you have an interface in the schema with no Object implementing it, This gets into a major error. Codegen generates wrong field types with empty values. I think it is because it cannot detect the __typename for the interface type.
Kind of a feature request, I didn't want to open a new one as I think it relates to this issue : It would also be nice if this would only generate the car type on autos instead of the union of car | truck as nothing from this query would be anything but a car
query GetCars {
autos {
... on Car {
wheelCount <- moved inside interface
name
}
}
}
Intended outcome:
With interface types, the codegen fails to produce the expected hierarchy of types.
For example:
GraphQL Schema
Queries
Generated Code
In the generated code above, I would have expected some
interface <> extends <>
structure so that we could pass a parent type around in our codebase.Actual outcome:
There is no hierarchy and therefore I have to use fixed (non-dynamic) types in order for typescript to compile.
How to reproduce the issue:
See above example.
Versions
The text was updated successfully, but these errors were encountered: