News for hackers. Stuff that matters.
Re:Parse, Don’t Validate by scrollaway on Thursday November 07, 2019 @07:08PM (#21478825)
This SO answer is pretty clever: https://stackoverflow.com/a/56006703

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

That is: A type of "NonEmptyArray" of T is an array of one element of type T, followed by any number of type-T elements.

There are no comments on this comment yet.