I frequently have a collection that might be either undefined or empty. So I write this:
if ((thingies?.length ?? 0) > 0) ...
I guess that's not so bad in the grand scheme, but it ain't pretty. What I really want is a Bash-like operator that means "this variable exists, is an array, and has at least one element":
if (thingies#) ... // it's safe to access thingies[0]
Pretty sure that's not a thing. But what's the most concise Typescript expression of this?
if (array?.length)evaluates to a boolean true if it's an array with at least one item. 0 or undefined would both return false, so only positive numbers remain