mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
23 lines
656 B
TypeScript
23 lines
656 B
TypeScript
import invariant = require("invariant");
|
|
|
|
// will throw in dev mode (process.env.NODE_ENV !== 'production')
|
|
invariant(true);
|
|
|
|
// will pass in production (process.env.NODE_ENV === 'production')
|
|
invariant(true);
|
|
|
|
// will pass in dev mode and production mode
|
|
invariant(true, 'Error, error, read all about it');
|
|
|
|
// will throw in dev mode, and production mode
|
|
invariant(false, 'Some other error');
|
|
|
|
// will throw in dev mode, and production mode
|
|
invariant(0, 'Some other error');
|
|
|
|
// will throw in dev mode, and production mode
|
|
invariant('', 'Some other error');
|
|
|
|
// handles extra variables
|
|
invariant(true, 'Error, error, read all about it', 37, {}, 'hello');
|