Senior Backend Engineer / Stage 1 · Foundations
Represent valid input with TypeScript narrowing
"Already know" meets prerequisites. "Not relevant" removes the topic from your total but leaves what builds on it waiting.
Self-check
- You receive an unknown JSON value expected to contain an order ID and positive quantity. Write a narrowing parser and test a valid object, missing ID, null and negative quantity.
- Evidence to include: Return an explicit error for each invalid case; explain why a type assertion is insufficient.
Try it without the material first, then compare. Save your answer in your notes below. Report a problem with this self-check
Learning activities
1 activities- Not doneThe TypeScript Handbook (opens another site)
The official guide, written to be read top to bottom; Everyday Types and Narrowing are the core of this topic.
3 h