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
When generating TypeScript types from the following schema , I get "Cannot read property 'type' of undefined":
type ApplicationForm {
items: [Item!]!
}
interface Item {
id: ID!
}
interface Field {
id: ID!
label: String!
}
type RichTextItem implements Item {
id: ID!
content: String!
}
type TextField implements Item & Field {
id: ID!
label: String!
}
I think the code generator is confused by using both types that implement "Item" and "Item & Field".
The problem seems to be in pre-resolve-types.ts, in both transformPrimitiveFields and transformAliasesPrimitiveFields. At that point, the schemaType contains fields that fields do not.
A work-around, maybe even the solution, is to filter all schemaType fields before mapping them:
@TheReincarnator Hey, can you please share the operation that caused this issue? We have a potential PR that solves this issue, however, @mvestergaard is not able to produce a failing test (See #6874).
When generating TypeScript types from the following schema , I get "Cannot read property 'type' of undefined":
I think the code generator is confused by using both types that implement "Item" and "Item & Field".
The problem seems to be in
pre-resolve-types.ts
, in bothtransformPrimitiveFields
andtransformAliasesPrimitiveFields
. At that point, theschemaType
contains fields thatfields
do not.A work-around, maybe even the solution, is to filter all
schemaType
fields before mapping them:The text was updated successfully, but these errors were encountered: