We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e9c191 commit 8ab6524Copy full SHA for 8ab6524
src/polyfills/flatMap.js
@@ -5,11 +5,14 @@ declare function flatMap<T, U>(
5
fn: (item: T, index: number) => $ReadOnlyArray<U> | U,
6
): Array<U>;
7
8
+// Workaround to make older Flow versions happy
9
+const flatMapMethod = (Array.prototype: any).flatMap;
10
+
11
/* eslint-disable no-redeclare */
12
// $FlowFixMe
-const flatMap = Array.prototype.flatMap
13
+const flatMap = flatMapMethod
14
? function(list, fn) {
- return Array.prototype.flatMap.call(list, fn);
15
+ return flatMapMethod.call(list, fn);
16
}
17
: function(list, fn) {
18
let result = [];
0 commit comments