The problem gets worse if your property is an array or an object. Shouldn't static members be accessed by its class? The problem with your OP code is that you're taking in a type of Constructor
Unfortunately, this pattern has undesirable behavior when you subclass Base. Hence the key-remapped type. If I @ts-ignore the line, I get the correct console output.
I tried looking at the codebase of sequelize and replicating it, as they have a similar typing with their models, but the types are so complex, that I didn't get it to work. Announcing the Stacks Editor Beta release! type ImplementerOfAClass
The first option (without the static) is better in my opinion. Right - this is something like inheritance, but it doesn't and shouldn't generally work for your static properties. But then B.printFoo() will also print "foo A". Sign in Only arrays and iterables are allowed in Angular-11 Application, Why is @angular/core/core has no exported member 'FactoryDeclaration'. You can use extends to create a subclass and still have access to the foo() function. I think that is useful to access to static members : The text was updated successfully, but these errors were encountered: We can't do it the way you suggest since this.type is used to access an instance property named type, not a static property.
I ran into this problem when implementing a new Mongoose feature that requires a more robust notion of static properties.