Hacker News new | ask | show | jobs
by anamexis 1164 days ago

    type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
    type FlatMap<In, Out> = (array: Array<In>, fn: (el: In) => ValueOrArray<Out>) => Array<Out>;
1 comments

This does not work, that's the issue, try to run it.
It seems to work for me, what issue are you seeing?

https://www.typescriptlang.org/play?target=6#code/C4TwDgpgBA...