Hacker News new | ask | show | jobs
by triyambakam 1191 days ago
Do you mean pass in a type?

    type NonEmptyArray<T> = [T, ...T[]];
1 comments

I mean if I have a NonEmptyArray say xs, and I then xs.map(x=>2*x), will the result of this expression be a NonEmptyArray ?
No, unfortunately it will just be number[] as the return type.