Isn't that overkill? You can check exhaustiveness with a trivial little helper:

    function exhaustive(witness: never): never {
      return witness
    }
https://www.typescriptlang.org/play/?#code/FAFwngDgpgBAKgZQB...

Agree, python calls this little helper assert_never[0]. I opened an PR to add it to the TypeScript docs some time ago: https://github.com/microsoft/TypeScript-Website/pull/3599

[0]: https://docs.python.org/3/library/typing.html#typing.assert_...

[deleted]

In the example you don't even need the default clause and the helper (the error message without it is worse though).

you can just to

    default:
        matched satisfies never
        throw new Error(...)
You don't even need a function.