Home > rc-js-util > _Production > assertValueIsNever
A function that will error if ever called. The parameter is asserted to be never, useful with switch statements, union types etc.
Signature:
static assertValueIsNever(_value: never): never;
Parameter | Type | Description |
---|---|---|
_value | never |
Returns:
never
// adding extra values to the enum will cause a compiler error
enum ETest { Foo = 1 };
function test(value: ETest)
{
switch (value) {
case ETest.Foo: return "potato";
default: return _Production.assertValueIsNever(value);
}
}