dotansimha / dotansimha/graphql-code-generator

Allow generating scalar typecasts

Open
#7,587 1 comment 4 reactions 0 assignees View on GitHub
core feature-request
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Is your feature request related to a problem? Please describe.**

The scalar configuration of the typescript plugin allows setting the generated type annotations but doesn't actually do any casts. This results in a mismatch between the annotated type and the real type (ie, a field is marked as a Date when it's actually still a `DateTime` String from graphql-scalars)

**Describe the solution you'd like**

Allow me to pass functions for casting scalars, to be applied whenever the scalar is in the return schema. Ideally with an easy shortcut for the graphql-scalars library because they're both projects of The Guild!

**Describe alternatives you've considered**

- There are some (honestly really buggy) middlewares for urql and apollo which provide scalar casting, but they require loading the schema at runtime, which inflates bundle size and makes for worse performance

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.