HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by throwaway09432 | Hacker News Reader
Parent
Full thread
throwaway09432
·
Can you map over this and preserve the NonEmptyArray type?
View on HN
triyambakam
·
Do you mean pass in a type?
type NonEmptyArray<T> = [T, ...T[]];
throwaway09432
·
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 ?
triyambakam
·
No, unfortunately it will just be number[] as the return type.
Reply on news.ycombinator.com