Don't capture vars in closure when using typeof