~/talk

Safely Handling Dynamic Data with TypeScript

Talkat OpenJS World 2021 · 2021-06-02..06-03· [typescript, javascript]
slides:none on file

Combines TypeScript static types with runtime JSON Schema validation to make API inputs and responses safe, using Fastify + TypeBox + AJV on the server and the Indici HTTP client on the client. Builds a POST /add-user route that derives TypeScript types from TypeBox schemas, validates requests with AJV, and returns "user 123 was added successfully" in the demo; sending wrong fields yields a 400 and the client logs the unexpected response.

AI-written summary · about

  1. 0:00Introduction to dynamic data
  2. 1:11The dangers of unknown types
  3. 3:09Leveraging JSON schema
  4. 7:27Client-side type safety
  5. 10:28Live coding demonstration
  6. 15:57Conclusion and resources
~/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.