dotansimha / dotansimha/graphql-typed-document-node
Cannot make it work using vue-apollo
- Dominant language
- TypeScript
- Stars
- 412
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to make it working, but unsuccesfully.
Could you be so kind to check it out?
I am using @vue/apollo-composable 4.0.0-alpha.16
This is my code:
```js
import { GetCountry , Country} from '../generated/graphql'
setup() {
const route = useRoute()
const code = route.params.code
const { result, loading } = useQuery(GetCountry, {code: code}, {
clientId: 'default',
fetchPolicy: 'cache-first'
});
const country: Country = useResult(result, {}, (data) => data.country);
console.log(country.continent)
return {
country,
loading
}
}
```
By assigning the type Country to the const country I get the following error:
`Type 'Readonly>>' is missing the following properties from type 'Country': code, continent, emoji, emojiU, and 5 more.`
This is Country and GetCountry from the generated code:
```js
export type Country = {
__typename?: 'Country';
capital?: Maybe;
code: Scalars['ID'];
continent: Continent;
currency?: Maybe;
emoji: Scalars['String'];
emojiU: Scalars['String'];
languages: Array;
name: Scalars['String'];
native: Scalars['String'];
phone: Scalars['String'];
states: Array;
};
export const GetCountry = gql`
query getCountry($code: ID!) {
country(code: $code) {
code
name
native
phone
capital
currency
emoji
continent {
code
name
}
languages {
code
name
}
states {
code
name
}
}
}
```
Am I doing something wrong?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.