我有这个.tsx文件
import React,{ Component } from 'react'; export class SidebarItem extends Component { constructor (props) { super(props); } render () { return (<li>{this.props.children}</li>); } }
解决方案是安装React Types定义
原文链接:https://www.f2er.com/react/300724.htmlyarn add -DE @types/react
来自typescript docs和types repo的更多细节
在旁注中我不得不重新启动vscode以使linting正确启动.