You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One thing that I am missing is the ability to generate a string union type to represent all possible enum values - would this be something you'd consider adding to the library?
For example with the Pokemen example in the repo:
exporttypePokemonType="Bug"|"Dark"|"Dragon"/* etc. */;
Proposed Solution
We should have a user accessible function, so, to keep things simple, a method on graphql, e.g. graphql.scalar() should be suitable.
This method should accept a scalar or enum name, and optionally a value, and should type check
said value against the allowable scalar/enum type.
The return type should be inferred to be the enum/scalar type (or a more exact one when a value is passed so ReturnType can be used to get the raw type.
Requirements
We must be able to get the raw return type
e.g. ReturnType<typeof graphql.scalar('PokemonType')>
We must be able to type check a value
e.g. graphql.scalar('Pokemontype', 'Bug')
The text was updated successfully, but these errors were encountered:
kitten
added
the
future 🔮
An enhancement or feature proposal that will be addressed after the next release
label
Jan 28, 2024
Originally requested on Discord by
@hazlad
Summary
Proposed Solution
We should have a user accessible function, so, to keep things simple, a method on
graphql
, e.g.graphql.scalar()
should be suitable.This method should accept a scalar or enum name, and optionally a value, and should type check
said value against the allowable scalar/enum type.
The return type should be inferred to be the enum/scalar type (or a more exact one when a value is passed so
ReturnType
can be used to get the raw type.Requirements
ReturnType<typeof graphql.scalar('PokemonType')>
graphql.scalar('Pokemontype', 'Bug')
The text was updated successfully, but these errors were encountered: