ts-to-zod support for auto generated zod object's strict()
See original GitHub issueFeature description
Couldn’t find ts-to-zod way for enforcing strict on zod schema.
Input
export type Student = {
name?:string;
};
Output
export const studentSchema = z.object({ name: z.string().optional() });
Expected Schema
export const studentSchema = z.object({
name: z.string().optional()
}).strict();
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Issues · fabien0102/ts-to-zod - GitHub
Generate zod schemas from typescript types/interfaces - Issues · fabien0102/ts-to-zod. ... ts-to-zod support for auto generated zod object's strict().
Read more >TypeScript-First Schema Validation with Static Type Inference
You can disallow unknown keys with .strict() . If there are any unknown keys in the input, Zod will throw an error. const...
Read more >Zod | Documentation
Zod is a TypeScript-first schema declaration and validation library. I'm using the term "schema" to broadly refer to any data type, from a...
Read more >Data validation with automatic typing using zod - CodeX Team
1. Validate without description a mountain of different if, instanceof, typeof and other things. 2. Have TypeScript types to represent the data we...
Read more >Validating Input with Zod in TypeScript | by Dries Augustyns
Let's create a Zod schema to validate an entire object. ... Using strict() you can let Zod know that it should only allow...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@fabien0102 Tried it. But it doesn’t work with nested type/interface. We would have to add
strict()for all child types/interface.Sorry, I didn’t have the time recently… But I’m always open for PR reviews 😇