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

Bug: Intersect 内存在 union 时,union 外侧的配置项如果有默认值,则将外侧配置项设置为 null 会导致默认值失效 #45

Closed
shigma opened this issue May 5, 2023 · 0 comments

Comments

@shigma
Copy link
Owner

shigma commented May 5, 2023

最小复现:

const validate = Schema.intersect([
  Schema.object({ a: Schema.boolean().default(true) }),
  Schema.union([
    Schema.object({ b: Schema.const(true) }),
    Schema.object({ b: Schema.const(false) }),
  ]),
])
validate({ a: null }) // { a: null }
@shigma shigma closed this as completed in 3531b51 May 5, 2023
shigma added a commit that referenced this issue May 16, 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

No branches or pull requests

1 participant