dotansimha / dotansimha/graphql-code-generator

typescript-nhost does not decouple typings when used with external types

Open
#9,250 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Is your feature request related to a problem? Please describe.

I want to decouple typings from `typescript-nhost` as I use both, nhost and apollo. This is my config
```ts
const config: CodegenConfig = {
schema: [
{
'https://xxx.nhost.run/v1/graphql': {
headers: {
'x-hasura-admin-secret': 'XXX'
},
},
},
],
ignoreNoDocuments: true, // for better experience with the watcher?? took from nhost example
documents: ['src/**/*.gql', '../../apps/feg/src/**/*.(gql)'],
generates: {
'src/lib/gql/__codegen__/types.ts': {
plugins: [
'typescript',
'typescript-operations',
],
config: {
dedupeFragments: true
}
},
'src/lib/gql/__codegen__/generated-schema.ts': {
preset: 'import-types',
plugins: [
'typescript-react-apollo'
],
presetConfig: {
typesPath: './types'
},
config: {
dedupeFragments: true
}
},
'src/lib/gql/__codegen__/nhost-schema.ts': {
preset: 'import-types',
plugins: [
'typescript-nhost'
],
presetConfig: {
typesPath: './types'
},
config: {
dedupeFragments: true
}
}
}
}
```

### Describe the solution you'd like

Nhost plugin should use the types imported via
```ts
import * as Types from './types';

```

But the config is not used and all types are duplicated.

### Describe alternatives you've considered

_No response_

### Is your feature request related to a problem? Please describe.

_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.