3 ms·
Curious how you handle `request.formData()` in Form Actions and ensuring type safety there.
by gmaster1440 4y ago
Curious how you handle `request.formData()` in Form Actions and ensuring type safety there.
- naasking 4y ago> 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.
- hu3 4y agoWe use and recommend Zod for that: https://github.com/colinhacks/zod#error-handling https://github.com/colinhacks/zod#error-handling
- harunurhan 4y agoLike 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.html https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...