Open bbugh opened 5 years ago
Has this been resolved? I can't use the apollo mixin on my components without TS complaining
It hasn't been for me. I had to roll back the upgrade to 3.0.0 and stuck with rc7, unfortunately.
This is probably related to the addition of *.graphql
-typing in version 3.0.0-stable
.
It's also causing various other issues and unfortunately these kind of types can't be excluded in tsconfig.
The relevant error message is:
Property 'query' is missing in type 'typeof import("*.gql")'
And *.gql
is typed in https://github.com/vuejs/vue-apollo/blob/dev/packages/vue-apollo/types/gql.d.ts as follows:
declare module '*.gql' {
import { DocumentNode } from 'graphql'
const content: DocumentNode
export default content
}
"query" doesnt exist => type error.
Using an any type or generated types using graphql-code-generator would probably workaround this issue.
I did a PR which removes typings for *.gql
and *.graphql
from this library. This allows custom types which might be any
or more sophisticated: https://github.com/vuejs/vue-apollo/pull/881
Unfortunately there is no response yet.
Describe the bug
Hey @Akryum I know you how much you love TypeScript typing issues, so I just know you'll love this one! 🤪
When using TypeScript Vue component after upgrading vue-apollo
v3.0.0-rc7
tov3.0.0
, mixins no longer compile. Typed mixins can be done withvue-typed-mixins
or the using themixins
helper from Vuetify. I confirmed this by switching back to rc7 on a clean repository folder, building (works fine), then another clean repo folder with v3.0.0 and receive this error:To Reproduce
Use mixins with v3.0.0. Here's an example component that builds fine with 3.0.0-rc7, but breaks when the only change is to upgrade to 3.0.0:
Expected behavior
Mixins should work correctly in v3.0.0.
Versions
These are the versions as of the repository tag v3.0.0 (c36e334)
vue: vue@2.6.10 vue-apollo: vue-apollo@3.0.0 apollo-client: apollo-client@2.6.3
Additional context Add any other context about the problem here.