ClearAll[foo];
foo[x : {___List?(VectorQ[#, NumberQ] &)}] := Plus @@@ x
foo[{{1, 2}, {2, 3, 4}}]
{3, 9}
foo[{{1, 2}, {{3}}}]
foo[{{1, 2}, {{3}}}]
Note: You need to use NumericQ
in place of NumberQ
if you want foo[{{1, 2}, {2, 3, π}}]
to return {3, 2 + 3 π}
.