TS2322 "is not assignable to type" typescript react-router报错

前端之家收集整理的这篇文章主要介绍了TS2322 "is not assignable to type" typescript react-router报错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

问题描述 TS2322 "is not assignable to type"

react-router 4.0
typescript 2.3.x

TS2322: Type '{ path: string; key: string; component: ComponentClass<RouteComponentProps<any>> | StatelessCompo...' is not assignable to type 'In
trinsicAttributes & IntrinsicClassAttributes<Route<T>> & Readonly<{ children?: ReactNode; }> & ...'.
  Type '{ path: string; key: string; component: ComponentClass<RouteComponentProps<any>> | StatelessCompo...' is not assignable to type 'Readonly<T>'

这种情况应该typescript版本过低造成的 尝试使用typescript@2.5.3 问题解决

原文链接:https://www.f2er.com/react/302498.html

猜你在找的React相关文章