You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
306 B

3 years ago
// @flow
// This file is not actually executed
// It is just used by flow for typing
const prefix: string = 'Invariant failed';
export default function invariant(condition: mixed, message?: string | (() => string)) {
if (condition) {
return;
}
throw new Error(`${prefix}: ${message || ''}`);
}