dotansimha / dotansimha/graphql-code-generator

Codegen uses `DOM Event` type for my custom `Event` object in schema

Open
#7,775 1 comment 0 reactions 0 assignees View on GitHub
core stage/1-reproduction
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Issue workflow progress

_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_

- [x] 1. The issue provides a reproduction available on [Stackblitz](https://stackblitz.com/edit/github-1q79ue)

_Make sure to fork this template and run `yarn generate` in the terminal._

_Please make sure the Codegen and plugins version under `package.json` matches yours._

- [ ] 2. A failing test has been provided

- [ ] 3. A local solution has been provided

- [ ] 4. A pull request is pending review

---

**Describe the bug**

1. If I use the name `event` for an object codegen generates it but using `DOM Event` type :smile:

**To Reproduce**
Steps to reproduce the behavior:

1. My GraphQL schema:

```graphql
type Subscription {
event: Event!
}

type Event {
name: String!
}
```

2. My GraphQL operations:

```graphql
subscription event {
event {
name
}
}
```

3. My `codegen.yml` config file:

```yaml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript-urql-graphcache
```

**Expected behavior**

It generates my own `Event` type.

**Environment:**

- OS: `Windows 10`
- `"@graphql-codegen/typescript-urql-graphcache": "2.2.10"`
- NodeJS: `v16.14.2`

**Additional context**

![image](https://user-images.githubusercontent.com/41120635/163705999-5a2424bc-01bd-45f9-ab67-68c305fca2d3.png)

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.