~/talk

Binary Arithmetic in TypeScript's Type System

Talkat TSConf 2019 · on Friday, 2019-10-11· [typescript, developer-experience]
slides:none on file

Implements binary arithmetic in TypeScript's type system by encoding bits as 0|1, writing type-level bit flip and type-level bit add operations, mapping those across arrays to form 8‑bit integers and carrying between columns to add two bytes. Shows concrete conditional and mapped generic types, produces an array result for 8‑bit addition, and demonstrates type-level assertions as tests. The surprising part is doing full byte addition (with carries) purely in the type checker.

AI-written summary · about

  1. 0:00Intro
  2. 0:53Language
  3. 2:05Examples of type descriptions
  4. 4:05Types as Values
  5. 4:37Generic Types
  6. 5:17Fill In The Code
  7. 5:37Type Phrasing
  8. 5:51Type Safety in the Type System?
  9. 6:37Tuple Types!
  10. 9:16Introducing Integers
  11. 10:09Zero: Using Mapped Types
  12. 11:08More Mapping
  13. 11:58Addition With Bits
  14. 12:46Adding 3 Bits
  15. 14:56Reference: JavaScript Implementation
  16. 16:16Int8Add: Repeat for the rest of the bits
  17. 17:55Tests in the Type System!?
~/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.