-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typescript-resolvers] Add excludeTypes config to resolversNonOptiona…
…lTypename (#9339)
- Loading branch information
Showing
4 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
--- | ||
|
||
Add excludeTypes config to resolversNonOptionalTypename | ||
|
||
This disables the adding of `__typename` in resolver types for any specified typename. This could be useful e.g. if you're wanting to enable this for all new types going forward but not do a big migration. | ||
|
||
Usage example: | ||
|
||
```typescript | ||
const config: CodegenConfig = { | ||
schema: 'src/schema/**/*.graphql', | ||
generates: { | ||
'src/schema/types.ts': { | ||
plugins: ['typescript', 'typescript-resolvers'], | ||
config: { | ||
resolversNonOptionalTypename: { | ||
unionMember: true, | ||
excludeTypes: ['MyType'], | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters