MENU

Fun & Interesting

The Proper Way to Validate Arrays in TypeScript

Lucas Barake 888 lượt xem 4 months ago
Video Not Working? Fix It Now

Buy me a coffee! https://buymeacoffee.com/lucasbarake

Array validation shouldn't be all-or-nothing. It's far too common to blindly use z.array() and lose valid data when a single item fails validation. Let's see how to build a more graceful approach using Effect Schema.

Blog version: https://lucas-barake.github.io/the-proper-way-to-decode-arrays/

00:00 The Problem
01:20 The Solution: ArrayFromFallible
04:12 Usage Example
05:07 Nested Arrays
06:07 Bonus: decodeUnknownPartition

Comment