dotansimha / dotansimha/graphql-code-generator

Map field to a type

Open
#9,743 7 comments 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 have an ObjectType in my schema:

```graphql
type SomeObj implements Node {
id: ID!
}
```

In TS Codegen I'd like to map `SomeObj.id` to a specific type `type SomeObjId = string` as I'm trying avoid mixing different ids on TS level.

So the result in codegen-generated file would be this:

```diff
export type SomeObj = {
- readonly id: Scalars['ID']['output'];
+ readonly id: TagId;
```

I tried creating custom scalar `SomeObjID` on schema level but that breaks `Node` interface contract so cannot do that.

### Describe the solution you'd like

Is there a way to map such field?

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