dotansimha / dotansimha/graphql-code-generator

Types for input objects should not have a prototype

Open
#5,964 2 comments 0 reactions 0 assignees View on GitHub
core stage/0-issue-prerequisites
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Describe the bug**

The Javascript object that is returned for mutation inputs does not have a prototype but this is not reflected in the generated types.

See issue here: https://github.com/ardatan/graphql-tools/issues/1374

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

2. My GraphQL operations:

```graphql
{
Mutation: {
someMutation(_, { input }) {
input.hasOwnProperty() // this will throw an error since input does not have a prototype
}
}
}
```

3. My `codegen.yml` config file:
```yml
overwrite: true
schema: '...'
documents: null
generates:
src/...
config:
noSchemaStitching: true
useIndexSignature: true
namingConvention:
enumValues: 'change-case#upperCase'
plugins:
- add:
content: '/* tslint:disable */'
- 'typescript'
- 'typescript-resolvers'
```

**Expected behavior**

Can we create a special type for object-inputs to null out all of their prototype fields?

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.