Re:SvelteKit 1.0
by gmaster1440 on Wednesday December 14, 2022 @01:27PM
(#33987636)
Curious how you handle `request.formData()` in Form Actions and ensuring type safety there.
[ Parent
| on HN ]
> Curious how you handle `request.formData()` in Form Actions and ensuring type safety there.
Hopefully the same way typed programming languages do it: parsing and type checking.
We use and recommend Zod for that:
Re:SvelteKit 1.0
by harunurhan on Wednesday December 14, 2022 @04:12PM
(#33990649)
Like any user input, you do runtime type-checking and validation. TypeScript is especially great for that because it has type narrowing [0].
[0] - https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...