You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{CodegenConfig}from"@graphql-codegen/cli";constconfig: CodegenConfig={schema: "schema.graphql",documents: "document.graphql",generates: {"types.ts": {config: {mappers: {UserEdge: "Omit<{T}, 'user'>"// Post: "Omit<{T}, 'tags'>"// Post is `ResolverTypeWrapper<Omit<Post, 'authorEdge'> & { authorEdge: ResolversTypes['UserEdge'] }>`// when mapper is not specified.//// I expect that whole type to replace `{T}`.//// However, the type after mapper specification is// `Omit<Post, 'tags'>` which loses the `authorEdge` mapped type.}},plugins: ["typescript","typescript-resolvers"]}}};exportdefaultconfig;
Additional context
No response
The text was updated successfully, but these errors were encountered:
ryanrhee
changed the title
Using {T} in a custom mapper loses Omits
resolver: Using {T} in a custom mapper loses Omits
Feb 22, 2023
Which packages are impacted by your issue?
@graphql-codegen/cli, @graphql-codegen/typescript-resolvers
Describe the bug
When using a custom mapper with
{T}
, the recursive definition is lost, and the default type from the typescript package is used instead.#1631 says that
{T}
should be the recursive definition.Your Example Website or App
https://codesandbox.io/s/reverent-snowflake-7npr0h?file=/codegen.ts
Steps to Reproduce the Bug or Issue
yarn generate
in a codesandbox terminaltypes.ts
'sResolverTypes["Post"]
(line 119), note the definition which isResolverTypeWrapper<Omit<Post, 'authorEdge'> & { authorEdge: ResolversTypes['UserEdge'] }>
codegen.ts
and change the config by uncommenting line 11 so thatPost
gets a custom mapperyarn generate
types.ts
, and note that the new type is nowResolverTypeWrapper<Omit<Post, 'tags'>>
.Expected behavior
At step 5, I expect the type to be:
Screenshots or Videos
No response
Platform
graphql
version: 16.6.0Codegen Config File
Additional context
No response
The text was updated successfully, but these errors were encountered: