mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Adds support for invariant 2.2.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/// <reference path="./invariant.d.ts" />
|
||||
|
||||
// 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');
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for invariant 2.2.0
|
||||
// Project: https://github.com/zertosh/invariant
|
||||
// Definitions by: MichaelBennett <https://github.com/bennett000/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare let invariant:invariant.InvariantStatic;
|
||||
|
||||
declare module "invariant" {
|
||||
export = invariant;
|
||||
}
|
||||
|
||||
declare module invariant {
|
||||
interface InvariantStatic {
|
||||
(testValue:any, format?:string, ...extra:any[]):void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user