Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

TypeError when using the @connection directive #179

Open
@stramel

Description

@stramel

I ran into an issue with using the @connection directive that is causing a typing error in the associated generated file. If I // @ts-ignore the type error, everything functions but this seems like a poor solution for a generated file.

Query:

const query = graphql`
  query chatQuery {
    conversations: conversationsConnection(first: 50) @connection(key: "Chat_conversations", filters: []) {
      edges {
        node {
          ...ConversationList_conversations
        }
      }
    }
  }
`

Error from the associated generated file:

Type '{ kind: string; fragment: { kind: string; name: string; type: string; metadata: any; argumentDefinitions: { kind: string; name: string; type: string; defaultValue: any; }[]; selections: { kind: string; alias: string; ... 5 more ...; selections: ({ ...; } | { ...; })[]; }[]; }; operation: { ...; }; params: { ...; }; }' is not assignable to type 'ConcreteRequest'.
  The types of 'operation.selections' are incompatible between these types.
    Type '({ kind: string; alias: string; name: string; storageKey: any; args: ({ kind: string; name: string; value: number; fields?: undefined; } | { kind: string; name: string; fields: { kind: string; name: string; items: { ...; }[]; }[]; value?: undefined; })[]; ... 5 more ...; filters?: undefined; } | { ...; })[]' is not assignable to type 'readonly NormalizationSelection[]'.
      Type '{ kind: string; alias: string; name: string; storageKey: any; args: ({ kind: string; name: string; value: number; fields?: undefined; } | { kind: string; name: string; fields: { kind: string; name: string; items: { ...; }[]; }[]; value?: undefined; })[]; ... 5 more ...; filters?: undefined; } | { ...; }' is not assignable to type 'NormalizationSelection'.
        Type '{ kind: string; alias: string; name: string; args: ({ kind: string; name: string; value: number; fields?: undefined; } | { kind: string; name: string; fields: { kind: string; name: string; items: { kind: string; name: string; variableName: string; }[]; }[]; value?: undefined; })[]; ... 6 more ...; selections?: undef...' is not assignable to type 'NormalizationSelection'.
          Type '{ kind: string; alias: string; name: string; args: ({ kind: string; name: string; value: number; fields?: undefined; } | { kind: string; name: string; fields: { kind: string; name: string; items: { kind: string; name: string; variableName: string; }[]; }[]; value?: undefined; })[]; ... 6 more ...; selections?: undef...' is not assignable to type 'NormalizationLinkedField'.
            Property 'storageKey' is optional in type '{ kind: string; alias: string; name: string; args: ({ kind: string; name: string; value: number; fields?: undefined; } | { kind: string; name: string; fields: { kind: string; name: string; items: { kind: string; name: string; variableName: string; }[]; }[]; value?: undefined; })[]; ... 6 more ...; selections?: undef...' but required in type 'NormalizationLinkedField'.ts(2322)

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