10000 v4: strictObject() has the same type as object() · Issue #4149 · colinhacks/zod · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v4: strictObject() has the same type as object() #4149

New issue

Have a question about this project? Sign up for a fr 8000 ee 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

Open
lo1tuma opened this issue Apr 14, 2025 · 2 comments
Open

v4: strictObject() has the same type as object() #4149

lo1tuma opened this issue Apr 14, 2025 · 2 comments

Comments

@lo1tuma
Copy link
Contributor
lo1tuma commented Apr 14, 2025

I want to build a function that only accepts strictObject() schemas, but it turns out those two schemas produce the exact same type:

import * as zod from '@zod/mini';
const x = zod.strictObject({}); // const x: zod.ZodMiniObject<{}, {}>
const y = zod.object({}); //  const y: zod.ZodMiniObject<{}, {}>

I would expect to either have a dedicated type like ZodMiniStrictObject<{}, {}> or a flag like ZodMiniObject<{}, {}, 'strict'>.

@colinhacks
Copy link
Owner

Not planned currently but I'll leave this open to gauge interest

@lo1tuma
Copy link
Contributor Author
lo1tuma commented May 16, 2025

I’m just curios about the reasoning behind this decision. In Zod v3 this was possible.

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

No branches or pull requests

2 participants
0