In React using Typescript we can do this:
constructor(props: Props) {
super(props);
this.state = {
teams: []
};
}
To explicitly let the typescript compiler know which props will be passed to the constructor lifecycle method. But we have already let the component know which props are available in the component in the class declaration
extends Component<Props, State> {
So it seems redundant to specify this again in all lifecycle methods. It seems that the Component types file support this(@types/react v. 16.4.16):
class Component<P, S> {
constructor(props: Readonly<P>);
So the question is why does this not work? (Typescript v. 2.9.2)