The problem with the examples you gave (suppose I understood it correctly) is that you need to hard-code types into your class declaration. Whatever supplied later during instantiation will not be actually used for type check.
I see that your code will work perfect with static linters, but the types you specified in the square brackets does not affect run-time behavior.