Learning on Web Dev Open is free for all.

Systems Thinking > TypeScript as a design toolNarrowing is most of the language
Phase 03TypeScript as a design tool161 of 434

Narrowing is most of the language

typeof, in, instanceof, literal checks, type predicates and assertion functions, applied to data that genuinely arrives in four shapes.

Build40 minAI adversary

Build this in your own editor

This one runs on your machine rather than in the browser workbench. Work to the outcomes below, then come back and mark it complete.

You should now be able to

  • Narrow a union through control flow without a cast
  • Write a type predicate that is actually sound
Ask the community

Loading…