Skip to content

Variables typing gives unexpected error #749

@MoSattler

Description

@MoSattler

Description

This code

import request, { RequestDocument, Variables } from 'graphql-request'

export const requestWrapper = <T, V extends Variables = Variables>(
  document: RequestDocument,
  variables: V,
) => request<T, V>('/api/graphql', document, variables)

gives me this error:

Argument of type '[V]' is not assignable to parameter of type 'VariablesAndRequestHeadersArgs<V>'.

Though unless I am missing something, the typing should work just fine. Is there anything I am doing wrong, or is something up with the typing?

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