apollographql / react-apollo

:recycle: React integration for Apollo Client
https://www.apollographql.com/docs/react/
MIT License
6.85k stars 787 forks source link

TypeScript types for graphql HOC not working (from Docs) #3944

Open chrisbutler opened 4 years ago

chrisbutler commented 4 years ago

Intended outcome: Use TypeScript with graphql HOC

Actual outcome: Type errors below

Type '({ data }: OptionProps<InputProps, Response, Variables>) => {}' is not assignable to type '(props: OptionProps<InputProps, Response, Variables>, lastProps?: void | ChildDataProps<InputProps, Response, Variables> | undefined) => ChildDataProps<...>'.
  Type '{}' is not assignable to type 'ChildDataProps<InputProps, Response, Variables>'.
    Property 'episode' is missing in type '{}' but required in type 'InputProps'.ts(2322)

How to reproduce the issue: Try to use the example from the Docs: https://www.apollographql.com/docs/react/development-testing/static-typing/#props

Version 2.6.8

  System:
    OS: macOS 10.15.3
  Binaries:
    Node: 12.16.2 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 80.0.3987.163
    Safari: 13.0.5