当我像这样扩展 React.Component 时:
export default class App extends React.Component<any, any > {
constructor (props: React.ReactPropTypes) {
super(props);
}
// other code
}
我收到以下警告:
./src/App.tsx [37, 50]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type, the empty type ('{}'), or suppress this occurrence. [37, 55]: Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type, the empty type ('{}'), or suppress this occurrence.
解决这些警告的最佳方法是什么?
最佳答案
在你的 tslint.json 中你可以放:
{"rules": {
"no-any": false
}
}
关于reactjs - 扩展 React.Component 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47573424/