A predicate returning `x is T` teaches the compiler what a runtime check proved.
Category
Snippets in TypeScript
Composes the built-in helpers rather than writing a second interface that will drift from the first.
Assigning to never makes the compiler fail the build when a new union member is added and left unhandled.
unknown forces a parse step rather than letting an any spread silently through the codebase.
`as const` keeps the literal types, so the derived union is the actual keys rather than string.