Skip to content

Commit

Permalink
Fix 'isFinite' polyfill resulting in infinite recursion (#2143)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Aug 29, 2019
1 parent 37cbb6a commit d008e96
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/polyfills/isFinite.js
@@ -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;

0 comments on commit d008e96

Please sign in to comment.