Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
triyambakam
on March 19, 2023
|
parent
|
context
|
favorite
| on:
TypeScript 5.0
Do you mean pass in a type?
type NonEmptyArray<T> = [T, ...T[]];
throwaway09432
on March 19, 2023
[–]
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
on March 22, 2023
|
parent
[–]
No, unfortunately it will just be number[] as the return type.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: