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
{{ message }}
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
exportconstFormattedDiceRoll=createFragmentContainer(DiceRollRenderer,{diceRoll: graphql` fragment formattedDiceRoll_diceRoll on DiceRoll { result detail { ... on DiceRollOperatorNode { __typename content } ... on DiceRollConstantNode { __typename content } ... on DiceRollOpenParenNode { __typename content } ... on DiceRollCloseParenNode { __typename content } ... on DiceRollDiceRollNode { __typename content rollResults { dice result category } } } } `,});
Generated Code:
exporttypeformattedDiceRoll_diceRoll={readonlyresult: number;readonlydetail: ReadonlyArray<{readonly__typename: "DiceRollOperatorNode";readonlycontent: string;}|{readonly__typename: "DiceRollConstantNode";readonlycontent: string;}|{readonly__typename: "DiceRollOpenParenNode";readonlycontent: string;}|{readonly__typename: "DiceRollCloseParenNode";readonlycontent: string;}|{readonly__typename: "DiceRollDiceRollNode";readonlycontent: string;readonlyrollResults: ReadonlyArray<{readonlydice: string;readonlyresult: number;readonlycategory: DiceRollCategory;}>;}|{/*This will never be '%other', but we need some value in case none of the concrete values match.*/readonly__typename: "%other";}>;readonly" $refType": "formattedDiceRoll_diceRoll";};
But this is how I expect union types to work. IMHO interface fields should not require that much boiler plate code.
GraphQL Codegen supports generating the "correct" interface selection set typings.
Schema Types:
Generated Type:
Expected Generated Type:
HOWEVER:
The following will generates the correct types:
Fragment Container:
Generated Code:
But this is how I expect union types to work. IMHO interface fields should not require that much boiler plate code.
GraphQL Codegen supports generating the "correct" interface selection set typings.