AI summary by TwinMind
The Reason These Devs HATE TypeScript (& React)
Theo - t3․gg
5m 38s
TypeScript's Impact on Development Workflow
- TypeScript and React significantly improve application development experience
- Pre-TypeScript: consuming APIs/libraries was unpredictable, majority of errors were "undefined" in unexpected places
- No guarantee of data shape when making requests/responses
- TypeScript provides contracts defining expected data shapes and validation
The Burden Shift Phenomenon
- TypeScript works best when developers don't write type definitions themselves
- At Ping: minimal type definitions written due to database queries, tRPC usage, type inference from creation to consumption
- Type inference requires libraries that handle inference well and expose correct types
- Burden shifted from application developers to library developers
- Library authors face constant GitHub issues requesting TypeScript support
Library Development Challenges with TypeScript
- Projects like Svelte/SvelteKit moved from TypeScript to JSDoc for typed contracts without compilation overhead
- TypeScript often burdens library developers despite improving library consumption
- Work previously done by application developers per library usage now done once by library authors
- Breaking changes from dependency updates easier to track with TypeScript red squiggly lines/build errors
Architecture and Performance Impact
- Library developers forced to change entire architectures for proper typing
- Functional, performant code requires fundamental changes for correct type contracts
- UploadThing example: working functions wrapped in 15 additional layers for type passing
- Performance degradation in libraries due to TypeScript requirements for good DX
- Additional staff required for maintaining correct TypeScript implementations
Server Components Complexity
- Server components incredible for application developers
- Library support for server components extremely challenging
- UploadThing had working implementation that infinite looped in some developer environments
- Couldn't ship due to reliability issues
- Popular tech combo (React + TypeScript) requires significant library-specific work
Development Difficulty Comparison
- Building applications with TypeScript easier than building libraries with TypeScript
- Application development work decreased because work shifted to library authors
- Library maintenance becomes harder despite potential future benefits
- Building TypeScript libraries for consumption much harder than building TypeScript applications
Community Acknowledgments
- Colin (Zod creator)
- Tanner Lindsley (TanStack React Query creator)
- TK Dodo (React Query documentation and contribution process)
- Alex (tRPC creator) - proved previously unimaginable TypeScript inference possibilities
- Julius - T3 contributor, tRPC contributor, now leading UploadThing development
- Hundreds more TypeScript advocates enabling viable ecosystem
