apollographql / react-apollo

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

useMutation incorrectly includes `errorPolicy` in its option types #3728

Open Jayphen opened 4 years ago

Jayphen commented 4 years ago

The types for useMutation indicate that it does support errorPolicy.

useMutation is typed with OperationVariables as the second parameter: https://github.com/apollographql/react-apollo/blob/master/packages/hooks/src/useMutation.ts#L8

OperationVariables has an errorPolicy type https://github.com/apollographql/react-apollo/blob/master/packages/common/src/types/types.ts#L34

Thus, the typings for useMutation indicate that it supports errorPolicy, when in fact the setting will be silently ignored.

@apollo/react-hooks 3.0.1

jamesreggio commented 4 years ago

I've opened a PR here: https://github.com/apollographql/apollo-client/pull/5863