How to check if subject is ZodObject?
See original GitHub issueAt the moment I am doing:
const foo = z.object({
name: z.string(),
});
console.log(foo?._def?.typeName === 'ZodObject');
Though this relies on accessing an internal property.
For context, it is needed to make https://github.com/gajus/slonik/issues/364 work.
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
colinhacks/zod: TypeScript-first schema validation ... - GitHub
By default Zod object schemas strip out unrecognized keys during parsing. You can disallow unknown keys with .strict() . If there are any...
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 >Schema validation in TypeScript with Zod - LogRocket Blog
In this article, you will learn about schema design and validation in Zod and how to run it in a TypeScript codebase at...
Read more >Zod Schema Validation - VeeValidate
The toFormValidator function accepts a Zod object schema and prepares it to be consumed by the vee-validate validation logic. You can pass the...
Read more >TypeScript schema validation with Zod - Iskander Samatov
Let's start off with the simplest example - primitives. Zod makes it extremely easy to create simple schemas to validate primitives. Let's see...
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 FreeTop 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
Top GitHub Comments
I wonder if this is a case of the remix library having a different copy of Zod installed which would cause
instanceof
checks to fail.Here’s some context:
Here’s the line in question: https://github.com/kiliman/remix-params-helper/blob/main/src/helper.ts#L28
After some digging, this is an esbuild configuration issue. For anyone bumping into this, this is what my
serverless.yml
config file looks like: