-
Notifications
You must be signed in to change notification settings - Fork 21
Open
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:
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<Ref<Readonly<any>>>' is missing the following properties from type 'Country': code, continent, emoji, emojiU, and 5 more.
This is Country and GetCountry from the generated code:
export type Country = {
__typename?: 'Country';
capital?: Maybe<Scalars['String']>;
code: Scalars['ID'];
continent: Continent;
currency?: Maybe<Scalars['String']>;
emoji: Scalars['String'];
emojiU: Scalars['String'];
languages: Array<Language>;
name: Scalars['String'];
native: Scalars['String'];
phone: Scalars['String'];
states: Array<State>;
};
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?
Metadata
Metadata
Assignees
Labels
No labels