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

TypeError when using the @connection directive #179

Open
stramel opened this issue Apr 6, 2020 · 1 comment
Open

TypeError when using the @connection directive #179

stramel opened this issue Apr 6, 2020 · 1 comment

Comments

@stramel
Copy link

stramel commented Apr 6, 2020

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)
@alloy
Copy link
Member

alloy commented Apr 7, 2020

Is this fixed with the linked DT PR being merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants