dotansimha / dotansimha/graphql-code-generator-community

typescript-generic-sdk unused generic paramter

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

Description

### Describe the bug

When generating a generic SDK (without raw requests) an unused generic param is introduced. This causes typescript errors when `noUnusedParameters` is set to true.

The bug was introduced in https://github.com/dotansimha/graphql-code-generator/pull/7689, ideally in https://github.com/dotansimha/graphql-code-generator/pull/7689/files#diff-c0735fcd78dffef10d637a4d56bc3d1e70efa65258aa96533d0fcced83254e75R98 a check should be added that if we are not generating a raw request the additional `E` generic should be dropped

### Your Example Website or App

https://codesandbox.io/s/nameless-sky-t833oi?file=/types.ts

### Steps to Reproduce the Bug or Issue

1. Use latest version of typescript-generic-sdk
2. When generating the sdk the Requester type had an unused generic param

### Expected behavior

I expect that the generated sdk does not contain unused params

### Screenshots or Videos

![Screenshot 2022-08-03 at 08 31 21](https://user-images.githubusercontent.com/1540483/182539795-8b2fc65d-c546-46c7-946a-d990809b6b5b.png)

### Platform

- OS: macOs
- NodeJS: 16
- `graphql` version: 16.5.0
- `@graphql-codegen/*` version(s):
- "@graphql-codegen/add": "3.2.0",
- "@graphql-codegen/cli": "^2.4.0",
- "@graphql-codegen/typescript": "2.7.2",
- "@graphql-codegen/typescript-operations": "2.5.2",
- "@graphql-codegen/typescript-generic-sdk": "2.5.0",
- "graphql": "16.5.0",
- "typescript": "4.7.4"

### Codegen Config File

```yaml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
config:
avoidOptionals:
field: true
documentMode: string
pureMagicComment: true
dedupeFragments: true
plugins:
- typescript
- typescript-operations
- typescript-generic-sdk
```

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