dotansimha / dotansimha/graphql-code-generator-community

`typescript-generic-sdk` generates types with unused values causing it to break linting if `"noUnusedParameters": true`

Open
#453 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Which packages are impacted by your issue?

@graphql-codegen/typescript-generic-sdk

### Describe the bug

The `typescript-generic-sdk` generates types with unused values causing it to break if `"noUnusedParameters": true, ` is set in the tsconfig. It also "breaks" if the rule is enabled in eslint.

```bash
types.ts:86:31 - error TS6133: 'E' is declared but its value is never read.

86 export type Requester = (doc: DocumentNode, vars?: V, options?: C) => Promise | AsyncIterable
```
[Link to the generated type in my repo](https://github.com/philiiiiiipp/graphql-code-generator-ts-bug/blob/c5b6da5ee8f54139fdada18b6d890632f08898f0/types.ts#L98)

### Your Example Website or App

https://github.com/philiiiiiipp/graphql-code-generator-ts-bug

### Steps to Reproduce the Bug or Issue

Checkout the repo and run `npm t` which will generate the types and start the linting

### Expected behavior

Looking at the types it does not need the generic parameter `E` so it should be removed.

### Screenshots or Videos

_No response_

### Platform

```
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-generic-sdk": "4.0.0",
"@graphql-codegen/typescript-operations": "4.0.1",
"typescript": "^5.2.2"
},
"dependencies": {
"graphql-tag": "2.12.6"
}
```

### Codegen Config File

```yml
generates:
./types.ts:
plugins:
- typescript
- typescript-operations
- typescript-generic-sdk
schema:
- ./schema.graphql
documents: [Query/**/*.ts]
```

### Additional context

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