Reactjs 如何修复typescript错误(Readonly<;{}>;&;Readonly<;{children?:ReactNode;}>;)?

Reactjs 如何修复typescript错误(Readonly<;{}>;&;Readonly<;{children?:ReactNode;}>;)?,reactjs,typescript,Reactjs,Typescript,如何修复typescript错误 我从工作的git存储库克隆了应用程序,启动并收到错误: 类型“Readonly&Readonly”上不存在属性“language”。TS2339 {/@ts忽略 this.props.language==='EN'//错误 “登录” :'LOGIN'}{'} 不幸的是,我不知道打字稿,所以我不得不寻求帮助 在本例中,您没有定义道具类型 interface PropType { language: string, } export default cla

如何修复typescript错误

我从工作的git存储库克隆了应用程序,启动并收到错误:

类型“Readonly&Readonly”上不存在属性“language”。TS2339


{/@ts忽略
this.props.language==='EN'//错误
“登录”
:'LOGIN'}{'}
不幸的是,我不知道打字稿,所以我不得不寻求帮助


在本例中,您没有定义道具类型

interface PropType {
  language: string,
}

export default class ComponentName extends React.Component<PropType> {
...
}
接口类型{
语言:字符串,
}
导出默认类ComponentName扩展React.Component{
...
}
如果您想了解有关typescript的更多信息,以下链接将非常有用


什么存储库?
interface PropType {
  language: string,
}

export default class ComponentName extends React.Component<PropType> {
...
}