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.

36 lines 1.34 kB
/** * @public * Utilities for production builds. */ export declare class _Production { /** * @deprecated * Throws an `Error` with the given message. If `_BUILD.DEBUG` is true and `_BUILD.DISABLE_BREAKPOINT_FLAG` is false or unset then a breakpoint will be hit first. * Should not be used for "expected" errors (bad input etc). */ static error(message: string): never; /** * Creates an `Error` with the given message. If `_BUILD.DEBUG` is true and `_BUILD.DISABLE_BREAKPOINT_FLAG` is false or unset then a breakpoint will be hit first. * Should not be used for "expected" errors (bad input etc). */ static createError(message: string): Error; /** * A function that will error if ever called. The parameter is asserted to be never, useful with switch statements, union types etc. * * @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); * } * } * ``` */ static assertValueIsNever(_value: never): never; private constructor(); } //# sourceMappingURL=_production.d.ts.map