If I have a union type like this:
union AllOnboardingQuestionTypes = StepFinal | TimeRangesQuestion | PercentQuestion | SingleSelectQuestion | MultiSelectQu
is this the right way to do the query?
Yes. Unions are restricted in this way according to the current (June2018) GraphQL specification. See also a corresponding issue on graphql.js
The aliases seem cumbersome
The best way to avoid this is for the schema to specify different field names when the return types differ.
I had the same problem and find three different solutions to it:
All not very nice but working. I put a simple example project with all solutions on Github: https://github.com/chnoack/apollo-dynamic-types-example