-
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.
Fix 'isFinite' polyfill resulting in infinite recursion (#2143)
- Loading branch information
1 parent
37cbb6a
commit d008e96
Showing
1 changed file
with
5 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
// @flow strict | ||
|
||
declare function isFinite(value: mixed): boolean %checks(typeof value === | ||
'number'); | ||
declare function isFinitePolyfill( | ||
value: mixed, | ||
): boolean %checks(typeof value === 'number'); | ||
|
||
/* eslint-disable no-redeclare */ | ||
// $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441 | ||
const isFinite = | ||
const isFinitePolyfill = | ||
Number.isFinite || | ||
function(value) { | ||
return typeof value === 'number' && isFinite(value); | ||
}; | ||
export default isFinite; | ||
export default isFinitePolyfill; |