inheritance rarely solves anything
type NonEmptyArray<T> = [T, ...T[]];
function isNonEmptyArray<T>(arr: T[]): arr is NonEmptyArray<T> {
return arr.length > 0;
}
function neverEmpty<T>(array: T[]): NonEmptyArray<T> | null {
if (!isNonEmptyArray(array)) return null
return array
}
not my title, but it is kinda in your face.
I agree “recommendations” or “pointers” would not come across as so selfğrighteous
Have you actually implemented a custom type guard or just asserted size?
I absolutely abhor it when the command includes $ that copies with it. It means nothing to the beginner’s and the pros know it is a command.
I wrote under other comment:
yeah, I’d give it as 4 separate copy-pastable commands and then write “or as one command…”
sorry for your disappointment
yeah, dude’s a beast
They probably mean “not running” as “I’ve written the types and the static type checker is not giving an error”
That’s still not a terrible ratio
yeah, I’d give it as 4 separate copy-pastable commands and then write “or as one command…”
on Voyager they
didn’t
They looked (>like this<)
your spoiler tags seem not to be working
how did you manage to play it on deck?
what is #>= operator?