Created
October 13, 2017 21:17
-
-
Save zerobias/d34b93b2e2f490f58f11084048b398bc to your computer and use it in GitHub Desktop.
Flow flatten type
This file contains hidden or 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
declare function flatten< | |
A, | |
B: $ReadOnlyArray<A> | A, | |
C: $ReadOnlyArray<B> | B, | |
D: $ReadOnlyArray<C> | C, | |
E: $ReadOnlyArray<D> | D, | |
>(xs: $ReadOnlyArray<E>): Array<A> | |
const listsList = [{ | |
items: [[10, 2], 3, [0, 1, [2], [1, [2]], ],2, [2, 3]] | |
}] | |
const items = listsList.map(({ items }) => items) | |
const ok: number[] = flatten(items) | |
const t = flatten(items).map(x => x + 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment