dotansimha / dotansimha/graphql-code-generator

set typesPrefix with enumPrefix doesn't work with typescript-resolvers

Open
#4,249 2 comments 4 reactions 0 assignees View on GitHub
core help wanted plugins stage/1-reproduction
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Describe the bug**

When enumPrefix is set to `false` typescript-resolver doesn't use prefixed type name even if typesPrefix is set to `T`.

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

1. set enumPrefix to `false`
2. set typesPrefix to `T`
3. graphql-codegen

Here is codesandbox.

https://codesandbox.io/s/quirky-proskuriakova-yyexo?file=/types.ts

1. My GraphQL schema:

```graphql
# Put your schema here
type Query {
user(id: ID!): User!
}

type User {
id: ID!
username: String!
email: String!
}
```

2. My GraphQL operations: (**Not related to this issue**)

```graphql
query user {
user(id: 1) {
id
username
email
}
}
# Put your operations here
```

3. My `codegen.yml` config file:

```yml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
config:
typesPrefix: T
enumPrefix: false
plugins:
- typescript
- typescript-operations
- typescript-resolvers

# Put your YML here
```

**Expected behavior**

generated resolver type should use prefixed type.

**Environment:**

- OS: macOS 10.15.4 catalina
- "@graphql-codegen/cli": "^1.15.3",
- "@graphql-codegen/typescript": "^1.15.3",
- "@graphql-codegen/typescript-resolvers": "^1.15.3"
- NodeJS: v10.20.1

**Additional context**

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.