Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Type-safe useQuery #129

Open
Open
@tsnobip

Description

@tsnobip

Right now, ~variables expects any type:

let useQuery:
  (
    ~client: ApolloClient.t=?,
    ~variables: 'raw_t_variables=?,
    ~notifyOnNetworkStatusChange: bool=?,
    ~fetchPolicy: ApolloHooksTypes.fetchPolicy=?,
    ~errorPolicy: ApolloHooksTypes.errorPolicy=?,
    ~skip: bool=?,
    ~pollInterval: int=?,
    ~context: Context.t=?,
    graphqlDefinition('t, 'raw_t)
  ) =>
  (variant('t), queryResult('t, 'raw_t, 'raw_t_variables))

So if you partially apply makeVariables by forgetting a non-optional argument for example, this won't be detected by the type-checker.

Any idea how to solve this?

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