Macro for typing an object safely.