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

Extend InferType to accept zod schema #54

Merged
merged 1 commit into from
Feb 1, 2023
Merged

Extend InferType to accept zod schema #54

merged 1 commit into from
Feb 1, 2023

Conversation

gksander
Copy link
Contributor

@gksander gksander commented Feb 1, 2023

Allow InferType to accept Zod schema, for use-cases where you're destructuring schema out of your query:

import type { InferType } from "groqd";
import { q } from "groqd";

const query = q("*").filter().grab({ name: q.string() });
type Thing = InferType<typeof query>;

// OR!

const { schema } = q("*").filter().grab({ name: q.string() });
type Thing = InferType<typeof schema>;

Copy link

@umxr umxr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! this is super helpful :)

@gksander gksander merged commit 32eaa05 into main Feb 1, 2023
@gksander gksander deleted the extend-infertype branch February 1, 2023 16:16
@github-actions github-actions bot mentioned this pull request Feb 1, 2023
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.

2 participants