Skip to content

graphql-jit and TypeGraphQL union issues.  #181

@reginsmol

Description

@reginsmol

I'm using TypeGraphQL for defining my schema and resolvers. When enabling graphql-jit and fetching a union type I got the following error:
Abstract type Notifiable must resolve to an Object type at runtime for field Notification.notifiable. Either the Notifiable type should provide a \"resolveType\" function or each possible types should provide an \"isTypeOf\" function

It works fine without graphql-jit.

TypeGraphQL union types docs

Union type definition:

const NotifiableUnion = createUnionType({
    name: 'Notifiable',
    types: () => [A,B,] as const,
    resolveType: value => {
        if ('title' in value) {
            return A;
        }

        return B;
    },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions