Last active
December 18, 2023 00:48
-
-
Save kdaisho/e1fffab7055a2cdb0a94c3eda24505f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { z } from 'zod'; | |
const mySchema = z.object({ | |
limit: z.number().default(10), | |
offset: z.number().default(0), | |
filter: z.object({ | |
requested: z.boolean(), | |
pending: z.boolean(), | |
approved: z.boolean(), | |
removed: z.boolean(), | |
promoted: z.boolean(), | |
}), | |
}); | |
// extracting type from zod schema | |
type Filter = keyof z.infer<typeof mySchema>['filter'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment