15 Feb
2022
15 Feb
'22
2:30 p.m.
On Tue, Feb 15, 2022 at 01:53:52AM -0800, Shantanu Jain wrote:
As far as I'm aware, type checkers already support this. We inherit from Any in typeshed in a couple places. The need to support Any inheritance also arises naturally as a result of gradual typing, e.g. if your base class comes from an untyped library or the import cannot be resolved.
I've used this trick myself a couple times and have seen use cases for this a couple times on gitter.im. It's a neat way to silence many errors from classes that do super dynamic things or to allow for classes that can duck type anywhere (e.g. mocks).
I don't understand why you need to subclass Any, instead of just using Any. What's the subclass do that Any doesn't?