Skip to main content

Practice ยท 1 of 3

Unknown Payload Handler

Write handleUnknown(payload) that narrows honestly: arrays of strings โ†’ { kind: "tags", tags } (trimmed); finite numbers โ†’ { kind: "count", count }; objects with string id โ†’ { kind: "entity", id }; anything else โ†’ { kind: "reject" }. Never throw.

Difficulty: intermediate

Back to lesson: Practice: Boundaries โ€” Practice