graphql-scalars icon indicating copy to clipboard operation
graphql-scalars copied to clipboard

Export scalar configs

Open beezee opened this issue 4 years ago • 1 comments

If you look here - https://github.com/graphql/graphql-js/blob/607345275f60e07dba1b7156a23b9ddf8b086fc9/src/type/definition.d.ts#L319

You'll see that applying a scalar config to the scalar constructor erases the type information associated with the underlying types on either side of the scalar parse/serialize.

If you expose the configs (done by the typings, not by the compiled js) then it allows typescript programmers to use those configs in places where they want to maintain type safe interactions with data coming in through these scalars.

Hopefully this is a small ask, happy to open a PR if you can point me in the right direction what to change.

beezee avatar Dec 25 '20 17:12 beezee

@beezee This would be nice! But currently I don't think we have that strong type safety in our scalar configuration for all of them. We need to move the configurations of each of them to a seperate variable.

ardatan avatar Dec 25 '20 23:12 ardatan

This is available in the latest release! Thanks for the idea!

ardatan avatar Sep 29 '22 18:09 ardatan