use `typeof` when checking if defined

I'm also writing 1.000 times "i will not anymore forget to use typeof"
:P