-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
feat: create zod union #6855
feat: create zod union #6855
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
8eb55f6
to
6bb4b28
Compare
6bb4b28
to
da6d2ef
Compare
b8f9239
to
badfad3
Compare
@@ -1,4 +1,5 @@ | |||
export * from './assert.js'; | |||
export * from './createZodUnion.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the enhancement! Could you move this file to packages/blocks/_common/utils/zod.ts
? There seems to be a better fit than the global
package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
badfad3
to
79a172f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feat!
## Features - toeverything/blocksuite#6948 @undefined - toeverything/blocksuite#6941 @undefined - toeverything/blocksuite#6855 @undefined ## Bugfix - toeverything/blocksuite#6967 @pengx17 - toeverything/blocksuite#6966 @pengx17 - toeverything/blocksuite#6951 @fundon - toeverything/blocksuite#6960 @fundon - toeverything/blocksuite#6964 @doouding - toeverything/blocksuite#6958 @Flrande - toeverything/blocksuite#6961 @regischen - toeverything/blocksuite#6957 @doouding - toeverything/blocksuite#6959 @regischen - toeverything/blocksuite#6956 @regischen - toeverything/blocksuite#6954 @fundon - toeverything/blocksuite#6955 @doouding - toeverything/blocksuite#6953 @doouding - toeverything/blocksuite#6952 @regischen - toeverything/blocksuite#6942 @golok727 - toeverything/blocksuite#6939 @fundon - toeverything/blocksuite#6940 @fundon - toeverything/blocksuite#6935 @regischen - toeverything/blocksuite#6930 @fundon - toeverything/blocksuite#6905 @golok727 - toeverything/blocksuite#6931 @donteatfriedrice ## Refactor - toeverything/blocksuite#6945 @shvixxl ## Misc - toeverything/blocksuite#6938 @golok727 - chore: correct typo
Add util function for creating zod union from arrays
example: packages/blocks/src/_common/consts:
The example shows that when creating a zod scheme, there are repetitions of values from the array. Such use leads to an unguaranteed schema change when changing the values of this array.
This can be avoided using createZodUnion utility
+simplification of the code
+ensuring an up-to-date scheme