UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

67 lines (37 loc) 1.09 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [\_Production](./rc-js-util._production.md) &gt; [assertValueIsNever](./rc-js-util._production.assertvalueisnever.md) ## \_Production.assertValueIsNever() method A function that will error if ever called. The parameter is asserted to be never, useful with switch statements, union types etc. **Signature:** ```typescript static assertValueIsNever(_value: never): never; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> \_value </td><td> never </td><td> </td></tr> </tbody></table> **Returns:** never ## Example ```typescript // 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); } } ```