export function flatten(arr: T[]): T[] { return arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []); }