https://github.com/tonyfromundefined/graphql-codegen-typescript-resolvers-define
🪡 Declare the Resolver beautifully using the `define` function
https://github.com/tonyfromundefined/graphql-codegen-typescript-resolvers-define
codegen graphql typescript
Last synced: 2 months ago
JSON representation
🪡 Declare the Resolver beautifully using the `define` function
- Host: GitHub
- URL: https://github.com/tonyfromundefined/graphql-codegen-typescript-resolvers-define
- Owner: tonyfromundefined
- Created: 2023-01-24T10:49:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T10:56:22.000Z (about 1 year ago)
- Last Synced: 2025-04-17T13:03:23.899Z (2 months ago)
- Topics: codegen, graphql, typescript
- Language: TypeScript
- Homepage:
- Size: 28.7 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-codegen-typescript-resolvers-define
Declare the Resolver beautifully using the `define` function output from GraphQL Codegen without ugly TypeScript type annotation.
## How to use
`codegen.yml````yml
generates:
./src/__generated__/resolvers.ts:
plugins:
- "@graphql-codegen/typescript"
- "@graphql-codegen/typescript-resolvers"# add this plugin
- "graphql-codegen-typescript-resolvers-define"
````MyResolver.ts`
```typescript
/**
* as-is
*/
import { Resolvers } from "../__generated__/resolvers";const MyObject: Resolvers['MyObject'] = {
// ...
}/**
* to-be
*/
import { defineResolvers } from "../__generated__/resolvers";const MyObject = defineMyObjectResolvers({
// ...
})
```