1 | // @flow
|
2 | // This file is not actually executed
|
3 | // It is just used by flow for typing
|
4 |
|
5 | const prefix: string = 'Invariant failed';
|
6 |
|
7 | export default function invariant(condition: mixed, message?: string) {
|
8 | if (condition) {
|
9 | return;
|
10 | }
|
11 | throw new Error(`${prefix}: ${message || ''}`);
|
12 | }
|