AI summary by TwinMind
Zod finally has competition (...created by Zod?)
Theo - t3․gg
12m 28s
Zod's Dominance and Limitations
- Zod took TypeScript world by storm as validator understanding both TypeScript and data validation
- Validates JSON, form data with checks for string length, number ranges, even emoji checking
- Limitations: not fastest validator, poor TypeScript performance, doesn't follow validation standards
Colin's Solution: Standard Schema
- Colin (Zod creator) researched validation standards compliance, hit problems
- Instead of fixing just for Zod, created ecosystem-wide solution
- Introduced Standard Schema reference working across multiple libraries
- Works with Zod, Valibot, Archetype, future libraries
Supporting Validation Libraries
- Valibot: Originally bachelor's thesis project by Fabian Hiller
- Focus on bundle size and performance
- Advised by Mishko (Angular creator) and Ryan Carniato (Solid creator)
- Archetype: Advanced type performance tooling
- Built AT-TEST library for benchmarking type definitions
- Tools for measuring type depth layers, generating stats on type definitions
- Only real solution for identifying TypeScript server failures in large codebases
Standard Schema Implementation
- Designed collaboratively by creators of Zod, Valibot, Archetype
- Interface: any library implementing this can follow standard
- Example: string validator extends StandardSchemaType<string, string>
- Validation function returns value or issues array
- Implementation requires only handful of lines of code
Target Audience and Use Cases
- Not for end users - library/framework authors primary target
- Framework creators (Next.js) can build using standard schema
- Supports all different validators without installing multiple libraries
- Eliminates need for validator-specific adapters
Current Ecosystem Support
- T3 Environment, Upload Thing, tRPC, TanStack Form, TanStack Router
- Hono middleware (in construction), Quick OpenAI (in construction)
- Renown and many others already supporting
TanStack Form Example
- Demo showing schema swapping between Zod, Valibot, Archetype
- Form automatically infers correct types using internal validation scheme
- Type errors consistent across different validators
- No adapter needed - direct schema passing
Impact on Library Development
- Eliminates need for validator-specific adapters
- Previously required wrapping validators in library-specific adapters
- Huge change for library authors - significantly easier to support multiple validators
- New validation libraries have easier entry path
Migration Benefits
- Enables TypeScript devs to use any validation library without tool support concerns
- Addresses old validation solution lock-in (people stuck on Yup due to tooling support)
- Potential tRPC TypeScript performance improvements
- Can move OpenAI integration to Zod or other validators
Future Outlook
- Not everything supports standard schema yet, but growing adoption
- Colin "killed Zod" by making it unnecessary to rely on single validator
- Rare example of creator making their own project less essential for ecosystem benefit
