2
0

♻️ Replace schemas with merge and discriminated unions

Closes #374
This commit is contained in:
Baptiste Arnaud
2023-03-14 16:42:12 +01:00
parent ff09814ead
commit d154c4e2f2
52 changed files with 3217 additions and 4328 deletions

View File

@ -10,7 +10,7 @@ export const defaultRatingInputOptions: RatingInputOptions = {
customIcon: { isEnabled: false },
}
export const ratingInputOptionsSchema = optionBaseSchema.and(
export const ratingInputOptionsSchema = optionBaseSchema.merge(
z.object({
buttonType: z.literal('Icons').or(z.literal('Numbers')),
length: z.number(),
@ -27,7 +27,7 @@ export const ratingInputOptionsSchema = optionBaseSchema.and(
})
)
export const ratingInputBlockSchema = blockBaseSchema.and(
export const ratingInputBlockSchema = blockBaseSchema.merge(
z.object({
type: z.literal(InputBlockType.RATING),
options: ratingInputOptionsSchema,