dotansimha / dotansimha/graphql-code-generator

TypeScript Operations should have declarationKind option for type queries and fragments

Open
#9,502 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Which packages are impacted by your issue?

@graphql-codegen/typescript-resolvers

### Describe the bug

Setting declarationKind to "class" doesn't target fragments, queries or QueryVariables

### Your Example Website or App

https://codesandbox.io/p/sandbox/hardcore-flower-mvv7y2

### Steps to Reproduce the Bug or Issue

Use codesandbox template and add
`config: { declarationKind: "class" },`

### Expected behavior

I expect all exports to be classes

### Screenshots or Videos

![image](https://github.com/dotansimha/graphql-code-generator/assets/11026872/9a512d42-4d91-4f0a-84d2-10f63e0ecf7f)

### Platform

- OS: macOS
- NodeJS: [e.g. 16.17.0]
"@graphql-codegen/typescript": "2.8.0",
"@graphql-codegen/typescript-operations": "2.5.5",
"graphql": "^16.2.0"

### Codegen Config File

import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
schema: "schema.graphql",
documents: "document.graphql",
generates: {
"types.ts": {
config: { declarationKind: "class" },
plugins: ["typescript", "typescript-operations"],
},
},
};

export default config;

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