fallbackRender={FullPageErrorFallback} 报错
来源:7-5 实现Error Boundaries,捕获边界错误

raymondJ
2021-12-21
老师你好,我在调用ErrorBoundary的时候,fallbackRender报错如下
No overload matches this call.
Overload 1 of 2, ‘(props: ErrorBoundaryProps | Readonly): ErrorBoundary’, gave the following error.
Type ‘{ children: Element; fallbackRender: ({ error }: { error: Error | null; }) => Element; }’ is not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<…>’.
Property ‘fallbackRender’ does not exist on type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<…>’.
Overload 2 of 2, ‘(props: ErrorBoundaryProps, context: any): ErrorBoundary’, gave the following error.
Type ‘{ children: Element; fallbackRender: ({ error }: { error: Error | null; }) => Element; }’ is not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<…>’.
Property ‘fallbackRender’ does not exist on type ‘IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<…>’.ts(2769)
2回答
-
慕函数1077132
2022-03-31
我遇到这个问题是因为错误引用了 antd 的 ErrorBoundary。 改成自定义的 component 之后就解决了
00 -
小狼baby
2022-01-01
给FullPageErrorFallback的返回类型写成any就不报错了
00
相似问题