Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add graphql.scalar() utility to check/retrieve scalar/enum types #45

Merged
merged 6 commits into from
Jan 28, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Jan 28, 2024

Resolves #44

Summary

This adds a new identity method on graphql.scalar() that can either be used to retrieve or type check the type of scalars and enums.

To retrieve the type of a scalar it's used with typeof:

type testEnum = ReturnType<typeof graphql.scalar<'test'>>;

To check the type of a scalar it's used by calling it:

const test = graphql.scalar('test', 'more');

Set of changes

  • Add graphql.scalar() utility
  • Update docs

Copy link

changeset-bot bot commented Jan 28, 2024

🦋 Changeset detected

Latest commit: ba2f846

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten changed the title feat: Implement graphql.scalar() utility to check/retrieve scalar/enum types feat: Add graphql.scalar() utility to check/retrieve scalar/enum types Jan 28, 2024
@kitten kitten merged commit 08e1b46 into main Jan 28, 2024
3 checks passed
@kitten kitten deleted the feat/graphql-scalar-types branch January 28, 2024 12:05
@github-actions github-actions bot mentioned this pull request Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Add helper function to get types of enums and scalars
2 participants