Closed
Description
react-error-boundary
version: 4.0.1node
version: 18.15.0npm
version: 9.5.0
Relevant code or config
import { ErrorBoundary } from 'react-error-boundary';
What you did:
Type checking without "skipLibCheck": true
in the tsconfig
What happened:
node_modules/react-error-boundary/dist/react-error-boundary.d.ts:56:93 - error TS2307: Cannot find module 'ErrorBoundaryContext' or its corresponding type declarations.
56 render(): import("react").FunctionComponentElement<import("react").ProviderProps<import("ErrorBoundaryContext").ErrorBoundaryContextType | null>>;
~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/react-error-boundary/dist/react-error-boundary.d.ts:56
Reproduction repository:
I suppose it can be reproduced in any repository which uses the library with TypeScript and lib check enabled, but happy to create one if you want.
Problem description:
Here is the relevant part of the published react-error-boundary.d.ts
.
The return type of the render()
method includes import("ErrorBoundaryContext").ErrorBoundaryContextType
which cannot be resolved.
export class ErrorBoundary extends Component<PropsWithRef<PropsWithChildren<ErrorBoundaryProps>>, ErrorBoundaryState> {
state: ErrorBoundaryState;
static getDerivedStateFromError(error: Error): {
didCatch: boolean;
error: Error;
};
resetErrorBoundary: (...args: any[]) => void;
componentDidCatch(error: Error, info: ErrorInfo): void;
componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
render(): import("react").FunctionComponentElement<import("react").ProviderProps<import("ErrorBoundaryContext").ErrorBoundaryContextType | null>>;
}
Suggested solution:
Not sure. Maybe add an explicit type like JSX.Element
for the return value of the render
method?
Metadata
Metadata
Assignees
Labels
No labels