upvote
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_...

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

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