Let's say I have the following component
class MyComponent extends
React.Component<IProps, IState> implements MyInterface {...}
Now I want to say that some variable is an instance of a React.Component that has IProps, IState and implements MyInterface, something like
myComponent: Component<IProps, IState> implements MyInterface, but this won't work and I have no idea why.
Can somebody clarify? I'm just starting with TypeScript and can't figure this out. What would be an alternative to that?
Please note:
myComponent: MyComponent is not what I'm looking for as an answer. I want to correct my misunderstanding of TypeScript instead.
myComponent: MyComponent?implementsandextendsonly work for classes and interfaces, you can't use them for variables