dotansimha / dotansimha/graphql-code-generator-community
Custom Resolver Function :Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
### Which packages are impacted by your issue?
@graphql-codegen/typescript-resolvers
### Describe the bug
When I use a customResolverFn typescript complains:
`Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
FILE ..generated/schema.ts:8:10`
6 | export type MakeOptional = Omit & { [SubKey in K]?: Maybe };
7 | export type MakeMaybe = Omit & { [SubKey in K]: Maybe };
8 | export { ResolverFn };
| ^^^^^^^^^^`
Disabling isolated modules then causes errors in other node modules.
### Your Example Website or App
https://codesandbox.io/s/vigilant-framework-03nz6r?file=/customType.ts
### Steps to Reproduce the Bug or Issue
Create a custom resolver like so:
[https://codesandbox.io/s/vigilant-framework-03nz6r?file=/customType.ts](https://codesandbox.io/s/vigilant-framework-03nz6r?file=/customType.ts)
### Expected behavior
export { ResolverFn } should be exported as a type
### Screenshots or Videos
_No response_
### Platform
- OS: macOS,
- NodeJS:16.5.0
- `graphql` version: 16.5.0
@graphql-codegen/cli": "^2.13.11",
@graphql-codegen/typescript": "^2.8.1",
@graphql-codegen/typescript-graphql-request": "^4.5.8",
@graphql-codegen/typescript-operations": "^2.5.6",
@graphql-codegen/typescript-resolvers": "^2.7.6",
### Codegen Config File
```yaml
overwrite: true
emitLegacyCommonJSImports: false
generates:
./src/gql/generated/schema.ts:
schema:
- ./src/gql/schema/*.ts:
noPluck: true
plugins:
- typescript
- typescript-resolvers
config:
makeResolverTypeCallable: true
customResolverFn: "./codeGenCustomTypes#DefaultResolver"
./src/gql/generated/operations.ts:
schema:
- ./src/gql/schema/*.ts:
noPluck: true
documents: ./src/gql/operations/*.graphql
plugins:
- typescript
- typescript-operations
- typescript-graphql-request
config:
typesPrefix: 'SDK_'
```
### Additional context
Am I missing a config option?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.