invariant.js.flow 359 B

12345678910
  1. // @flow strict
  2. export default function invariant(condition: mixed, message?: string): void {
  3. const booleanCondition = Boolean(condition);
  4. // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
  5. if (!booleanCondition) {
  6. throw new Error(
  7. message != null ? message : 'Unexpected invariant triggered.',
  8. );
  9. }
  10. }