getDefaults
sould return []
instead of undefined
for arrays
#970
Labels
getDefaults
sould return []
instead of undefined
for arrays
#970
The
getDefaults
function returnsundefined
as a default value forarray()
, but it's not ergonomic. I find myself always doing one of the following:undefined
, e.g. instead of doing a simple.push()
, I have to add anundefined
check or a nullish coalescing operator.optional()
with default value[]
I recommend to set the out-of-the-box default value to
[]
, as it covers the majority of use cases, and ifundefined
default is needed, there'soptional()
andundefinedable()
.outputs:
better output would be:
The text was updated successfully, but these errors were encountered: