Typing issue with parameters in generated query.
cchyung opened this issue · 1 comments
cchyung commented
Getting the following error when trying to use a generated query. When I run the code, the ID isn't getting passed into the query being called by Apollo for some reason. What am I doing wrong here?
Argument of type '{ id: string; }' is not assignable to parameter of type 'Omit<WatchQueryOptions<Exact<{ id?: string; }>, any>, "query">'.
Object literal may only specify known properties, and 'id' does not exist in type 'Omit<WatchQueryOptions<Exact<{ id?: string; }>, any>, "query">'.ts(2345)
Here's my usage in a svelte component
<script>
...
export let id: string
$: party = GetParty({ id }) // this is where the error is
...
</script>
Here's my GraphQL query:
export const PARTY_QUERY = gql`
query GetParty($id: ID) {
party(id: $id) {
_id
name
address
members
createdAt
updatedAt
nft {
name
collectionName
mediaUrl
description
purchasePrice
}
}
}
`
Here's the codegen config:
overwrite: true
schema:
- ../server/schema.graphql
generates:
./src/lib/api/index.ts:
config:
clientPath: ../../../apollo-client
asyncQuery: true
documents: "./src/lib/api/**/*.ts"
plugins:
- typescript
- typescript-operations
- graphql-codegen-svelte-apollo
add:
content:
- /* This file was automatically generated. Do not edit. */
- /* prettier-ignore */
- /* eslint-disable */
ticruz38 commented
you should use GetParty( { variables: { id } } )