-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
invariant: improve code that babel outputs (#2064)
- Loading branch information
1 parent
dea6028
commit 91a4be2
Showing
2 changed files
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// @flow strict | ||
|
||
export default function invariant(condition: mixed, message: string) { | ||
/* istanbul ignore file */ | ||
export default function invariant(condition: mixed, message?: string): void { | ||
const booleanCondition = Boolean(condition); | ||
/* istanbul ignore else */ | ||
if (!booleanCondition) { | ||
throw new Error(message); | ||
throw new Error(message || 'Unexpected invariant triggered'); | ||
} | ||
} |