CJY0208 / react-router-cache-route

Route with cache for react-router V5 like <keep-alive /> in Vue
https://www.npmjs.com/package/react-router-cache-route
MIT License
1.14k stars 110 forks source link

ts类型校验似乎是有问题 #122

Closed riminggit closed 2 years ago

riminggit commented 2 years ago

没有与此调用匹配的重载。 第 1 个重载(共 2 个),“(props: CacheRouteProps | Readonly): CacheRoute”,出现以下错误。 不能将类型“{ key: string; path: string; cacheKey: string; component: any; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”。 类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”上不存在属性“path”。 第 2 个重载(共 2 个),“(props: CacheRouteProps, context: any): CacheRoute”,出现以下错误。 不能将类型“{ key: string; path: string; cacheKey: string; component: any; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”。 类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”上不存在属性“path”。ts(2769) (JSX attribute) path: string

ylwbl commented 2 years ago

没有与此调用匹配的重载。 第 1 个重载(共 2 个),“(props: CacheRouteProps | Readonly): CacheRoute”,出现以下错误。 不能将类型“{ key: string; path: string; cacheKey: string; component: any; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”。 类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”上不存在属性“path”。 第 2 个重载(共 2 个),“(props: CacheRouteProps, context: any): CacheRoute”,出现以下错误。 不能将类型“{ key: string; path: string; cacheKey: string; component: any; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”。 类型“IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<...>”上不存在属性“path”。ts(2769) (JSX attribute) path: string

yarn add @types/react-router-dom -D 可以解决问题

ylwbl commented 2 years ago

react-router-dom 本身并没有提供ts支持

riminggit commented 2 years ago

感谢