But I wouldn’t do it. That kind of monkey patch could break numerous pieces of code which rely on the native behaviour, not to mention the adverse performance impact.
My take is that if you feel a need for that, it’s a “code smell” which is there to make you take note of the fact that perhaps you’re doing something wrong.
I’d suggest that if you feel such a need, perhaps what you need is better static analysis in your code. You might want to consider adding FlowType into your stack to make sure you’re not trying to access things you shouldn’t.