Skip to content

Typescript compilation error with latest apollo package #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2019

Conversation

ihpannu
Copy link
Contributor

@ihpannu ihpannu commented May 24, 2019

Fixed typescript compilation error

ERROR in /Users/harmandeeppannu/Desktop/app/tailwind-ts-app/node_modules/vue-apollo/types/options.d.ts
47:18 Interface 'VueApolloMutationOptions<V, R>' incorrectly extends interface 'MutationOptions<R, OperationVariables>'.
  Types of property 'optimisticResponse' are incompatible.
    Type 'Object | ((this: ApolloVueThisType<V>) => any) | undefined' is not assignable to type 'R | ((vars: OperationVariables) => R) | undefined'.
      Type 'Object' is not assignable to type 'R | ((vars: OperationVariables) => R) | undefined'.
        The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
          Type 'Object' is not assignable to type 'R'.
            The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
    45 | }
    46 |
  > 47 | export interface VueApolloMutationOptions<V, R> extends MutationOptions<R> {
       |                  ^
    48 |   mutation: DocumentNode;
    49 |   variables?: VariableFn<V>;
    50 |   optimisticResponse?: ((this: ApolloVueThisType<V>) => any) | Object;

@jvbianchi
Copy link

related with #577

@chanlito
Copy link

Please merge this 😬

@exls
Copy link

exls commented May 31, 2019

Merge and relase this please

@renestalder
Copy link

Tested @iharmanpannu's patch in an application where this was breaking and with the patch it works again. <3.

@stephen-bunn
Copy link

Is there any reason why this hasn't been merged yet? ❤️

@redjoker011
Copy link

Is there any reason why this hasn't been merged yet? ❤️

Me too waiting for this PR to be merged

@rille111
Copy link

Merge and relase this please! This is a breaking thing.

@ScreamZ
Copy link

ScreamZ commented Jun 16, 2019

@Akryum Can u take this in consideration ?

@anymost
Copy link

anymost commented Jun 17, 2019

wish merge this pull request as soon as possible. can't wait to fix this bug.

@aaronyoung0626
Copy link

Hope this would be merged ASAP, thx a lot!

@luispittagros
Copy link

@Akryum please merge and release this.

@@ -47,7 +47,7 @@ export interface VueApolloQueryOptions<V, R> extends ExtendableVueApolloQueryOpt
export interface VueApolloMutationOptions<V, R> extends MutationOptions<R> {
mutation: DocumentNode;
variables?: VariableFn<V>;
optimisticResponse?: ((this: ApolloVueThisType<V>) => any) | Object;
optimisticResponse?: ((this: ApolloVueThisType<V>) => any) | any
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is much better to use strong types:

optimisticResponse?: ((this: ApolloVueThisType<V>) => R) | R

@Akryum Akryum merged commit 9e3b2bf into vuejs:master Jun 20, 2019
@Akryum
Copy link
Member

Akryum commented Jun 20, 2019

Thanks 👍

@vuejs vuejs deleted a comment from exls Jun 20, 2019
@ralph
Copy link

ralph commented Jun 20, 2019

No type errors found - Finally! 🎉🙌

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

Successfully merging this pull request may close these issues.