How to handle a variable that might be an array or not in javascript?

I need to take an argument that is either an array of one type or the type on its own:

const foo = typeOrArrayOfType => myFunction([...typeOrArrayOfType, oneDefault]);

However if I do this:

const anArray = ['oneItem', 'twoItem'];
const notAnArray = 'oneItem';
const nonIterator = 300;
const oneDefault = 20;

const foo = typeOrArrayOfType => console.log([...typeOrArrayOfType, oneDefault]);

foo(anArray) // prints array items
foo(notAnArray) // spreads the string
foo(nonIterator) // error

It either works, spreads the string into characters or breaks entirely.

How can I flexibly take arguments that may or may not be an array?