unknown at the boundary, never any
any turns the type checker off for everything it touches. unknown accepts anything too, but you cannot use it until you have narrowed it, which is the whole point at a boundary.
function parse(input: unknown): Config {
if (!isConfig(input)) throw new Error("bad config");
return input; // narrowed
}JSON.parse, fetch responses, event payloads, environment variables: all unknown until proven otherwise.
typescript