wailroth
wailroth
Explore posts from servers
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
like that for example:
price: z.string({
required_error: "A price is required",
invalid_type_error: "Price should be a number"
}).transform((val) => parseInt(val)),
price: z.string({
required_error: "A price is required",
invalid_type_error: "Price should be a number"
}).transform((val) => parseInt(val)),
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
because, for example, my product take in attributes "price" which is a number, but with the 'useForm' hook, you'r forced to take a string, then transform it to a number, then submit it
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
In my case, I think i'll be forced to create a new schema
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
and like that:
productId: z.number({
required_error: "Product id is required",
invalid_type_error: "Product id is a number"
}).optional(),
name: z.string({
required_error: "A name is required",
invalid_type_error: "Name should be a string"
}),
productId: z.number({
required_error: "Product id is required",
invalid_type_error: "Product id is a number"
}).optional(),
name: z.string({
required_error: "A name is required",
invalid_type_error: "Name should be a string"
}),
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
but in this case, with and insertProductSchema, it doesnt work
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
No description
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
yeah; but I didnt see something in the doc: can you set custom messages if something is missing... Like I did in my custom schema?
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
i'll rtfm and stop annoying you
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
oh, okay lol
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
No description
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
No description
24 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
bless you
24 replies
DTDrizzle Team
Created by wailroth on 10/12/2023 in #help
Add even when object is null?
thanks mate
7 replies
DTDrizzle Team
Created by wailroth on 10/12/2023 in #help
Add even when object is null?
yeah it works
7 replies
DTDrizzle Team
Created by wailroth on 10/12/2023 in #help
Add even when object is null?
on userItems ?
7 replies
DTDrizzle Team
Created by wailroth on 10/12/2023 in #help
Add even when object is null?
up? :p
7 replies