Comment by kaoD
For those unfamiliar with TS, the above is just...
function flat([head, ...tail]) {
return Array.isArray(head)
? [...flat(head), ...flat(tail)]
: [head, ...flat(tail)]
}
...in TS syntax.For those unfamiliar with TS, the above is just...
function flat([head, ...tail]) {
return Array.isArray(head)
? [...flat(head), ...flat(tail)]
: [head, ...flat(tail)]
}
...in TS syntax.
Well, it is the type of that, in TS syntax. Few are the statically-typed languages that can even express that type.