export default class AwesomeProject extends React.Component {
constructor(props) { //this is the Error content: parameter `props` Missing annotation
super(props);
this.state = { content: '无数据' }; // Error: object literal This type is incompatible with undefined. Did you forget to declare type parameter `State` of property `Component`?
}
...
}
How can I fix it?
You need to provide a type annotation on the props argument to constructor. For example, if props just takes a string under "name", it might look like:
constructor(props: {name: string}){