Skip to content

Cannot read property 'type' of undefined on building with union result type #536

Closed
@ashkart

Description

@ashkart

I have an error when working with union result type.
Here is working demo
Uncomment getUserWithUnion method in resolver.ts to reproduce the problem.

TypeError: Cannot read property 'type' of undefined
    at /home/maxim/workspace/demo/node_modules/type-graphql/dist/schema/schema-generator.js:66:101
    at Array.map (<anonymous>)
    at types (/home/maxim/workspace/demo/node_modules/type-graphql/dist/schema/schema-generator.js:66:22)
    at resolveThunk (/home/maxim/workspace/demo/node_modules/graphql/type/definition.js:438:40)
    at defineTypes (/home/maxim/workspace/demo/node_modules/graphql/type/definition.js:837:15)
    at GraphQLUnionType.getTypes (/home/maxim/workspace/demo/node_modules/graphql/type/definition.js:806:26)
    at typeMapReducer (/home/maxim/workspace/demo/node_modules/graphql/type/schema.js:272:28)
    at typeMapReducer (/home/maxim/workspace/demo/node_modules/graphql/type/schema.js:286:20)
    at Array.reduce (<anonymous>)
    at new GraphQLSchema (/home/maxim/workspace/demo/node_modules/graphql/type/schema.js:145:28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Question ❔Not future request, proposal or bug issueSolved ✔️The issue has been solved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions