Allowing things to be `undefined` is awkward here.  I envisioned this as an array, and this function would fill it, then `executeCommands` would just walk over the commands and know nothing above the particular types, except if the sun will be rendered.  Keep two seperate lists if you need - one to for those returned by `update` and one for those that actually need to be executed.