• Exhaustiveness probe for a switch (msg.kind). Place at the default arm; the parameter type never is satisfied only when every variant has a matching case. Adding a tag to the union without a case arm is a compile error at this call site.

    The runtime throw is belt-and-suspenders only — it cannot be reached when the type-check passes.

    Parameters

    • value: never

      The post-narrowed message that should be never.

    Returns never

    Error citing the unmatched message variant.

    function update(msg: CounterMsg, g: Graph): void {
    switch (msg.kind) {
    case 'inc': return g.commit('inc', tx => ...)
    case 'dec': return g.commit('dec', tx => ...)
    case 'set': return g.commit('set', tx => tx.set(n, msg.value))
    default: return assertNever(msg)
    }
    }