dotansimha / dotansimha/graphql-code-generator-community

🐛 BUG: Type mismatch typescript-operations and typescript-vue-apollo

Open
#231 3 comments 0 reactions 1 assignee Claimed by @charlypoly View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Describe the bug

When I try to generate vue-apollo operations I get errors on the variables type that there is a mismatch.

### Your Example Website or App

https://www.typescriptlang.org/play?ssl=16&ssc=1&pln=15&pc=99#code/JYWwDg9gTgLgBDAnmApnA3nASigZnAXzlyghDgHIA3AVxQFoATFEYCgbgFgAoFAD0iw4zAMYAbAIZQ0SVNhQSRMYFRQAxGgDslwCJoA8AFQAKUiSAB8cALxwAFAEobVk2ZBduPfoPiy0AUT5FGCM4fhgUTUYAZww4AG0AaxREAC44aJgoYE0AcwBddK1EzQgAd01CK1tMeIBpOBy4ZMQIfENCuEN6-MIPb2hfZACARxoJMWijABo4AGVqngBIeI6wvgio2Pi53oB+e2WV3fXNmIS1g6y6OHTcCeiUZac7h6fuDx4-Rs0wGngajw4D8-jAipoSuVNDwCDwvsM4AA1KTACQAIzEKGipig5hQESgRmR2XRmOi1S6xNRGKxcAAPvJcESUaSsVYGThgip1FodHpmSSaeTPp5uN8IpkbHB-GMHvoqazsW58ShCYFgvocqCLBZZuqlJrfv92Yz9PqQlrjSbOTpVBptMp+ebDdqdTwAPTu4FwAB6B1s13eQA

### Steps to Reproduce the Bug or Issue

1. Run codegen
2. Check generated operations

### Expected behavior

The type used for variables should match in typescript operations and vue operations.

### Screenshots or Videos

```
Argument of type
'Exact<{
input?: InputMaybe | undefined; }> |
Ref | undefined; }>> |
ReactiveFunction | undefined; }>>
' is not assignable to parameter of type
'VariablesParameter<
Exact<{
input?: InputMaybe | undefined; }>>
'.
```

```
Argument of type
'Exact<{
input: INPUTTYPE; }> |
Ref> |
ReactiveFunction>
' is not assignable to parameter of type
'VariablesParameter<
Exact<{
input: INPUTTYPE; }>>
'.
```

### Platform

- OS: Windows 10
- `NodeJS@16.14.2`
- `graphql@16.6.0`
- `@graphql-codegen/cli@2.13.1`
- `typescript@ 4.8.4`

### Codegen Config File

```yaml
overwrite: true
schema:
documents:
generates:
./libs/shared/__generated__/src/lib/types.generated.ts:
plugins:
- 'typescript'
config:
scalars:
BigInt: bigint
typesPrefix: 'I'
withCompositionFunctions: true
federation: true

./libs/shared/__generated__/src/lib/operations.generated.ts:
preset: 'import-types'
plugins:
- 'typescript-operations'
config:
dedupeOperationSuffix: true
dedupeFragments: true
gqlImport: '@apollo/client/core#gql'
federation: true
typesPrefix: I
useTypeImports: true
presetConfig:
typesPath: ./types.generated

./libs/shared/__generated__/src/lib/use-graphql-operations.generated.ts:
preset: 'import-types'
plugins:
- 'typescript-vue-apollo'
config:
vueCompositionApiImportFrom: vue
dedupeOperationSuffix: true
dedupeFragments: true
typesPrefix: I
gqlImport: '@apollo/client/core#gql'
federation: true
useTypeImports: true
importOperationTypesFrom: Types
presetConfig:
typesPath: ./operations.generated
hooks:
afterAllFileWrite:
- prettier --write
- eslint --fix
```

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.