`is iterable` check errors on `undefined` values

{% if someVar is iterable %} errors out if someVar is undefined, with the following message: "undefined is not iterable (cannot read property Symbol(Symbol.iterator))". See Twig docs on iterable here: https://twig.symfony.com/doc/3.x/tests/iterable.html

I'm guessing that there needs to be something like an instanceof Object check on the variable before trying to access its Symbol.iterator.