~/talk

TypeScript Patterns for Better React Components

Talkat Øredev 2023 · 2023-11-08..11-10· [typescript, react]
slides:none on file

Walks through concrete TypeScript recipes: how to type Compound Components and Polymorphic Components, how to type and augment forwardRef so no type casts are needed, and how React Server Components work with TypeScript 5.1 (components can return Promise). Shows a working slot pattern that clones and merges props, recommends runtime parsing with Zod for API shapes, warns enums add bundle overhead, and reports interfaces sometimes speed up editor type-checking.

AI-written summary · about

  1. 0:00TypeScript and React history
  2. 6:43Boolean props and unions
  3. 11:25Custom vs styled components
  4. 12:30HTML attributes in React
  5. 16:49Typing function components
  6. 19:20Reusing types effectively
  7. 21:06Compound and polymorphic components
  8. 24:37Generics in components
  9. 25:41ForwardRef components
  10. 27:45React Context with defaults
  11. 29:32Overloading components
  12. 30:36Type vs interface for props
  13. 33:05Type annotations speed
  14. 35:16Zod for unknown types
  15. 37:50Cleaner TypeScript tooling
  16. 39:38TypeScript config and flags
  17. 41:28Summary and best practices
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.