Skip to content

Commit 7208cb4

Browse files
authored
Merge pull request #11 from doomsower/master
Add typescript definitions
2 parents df1ac62 + 2d7f8d2 commit 7208cb4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

index.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
3+
export interface FallbackProps {
4+
error?: Error;
5+
componentStack?: string;
6+
}
7+
8+
export interface ErrorBoundaryProps {
9+
onError?: (error: Error, componentStack: string) => void;
10+
FallbackComponent?: React.ComponentType<FallbackProps>;
11+
}
12+
13+
export function withErrorBoundary<P>(
14+
ComponentToDecorate: React.ComponentType<P>,
15+
CustomFallbackComponent?: React.ComponentType<FallbackProps>,
16+
onErrorHandler?: (error: Error, componentStack: string) => void,
17+
): React.ComponentType<P>;
18+
19+
export default class ErrorBoundary extends React.Component<ErrorBoundaryProps>{}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"homepage": "https://github.com/bvaughn/react-error-boundary",
66
"repository": "bvaughn/react-error-boundary",
77
"files": [
8-
"dist"
8+
"dist",
9+
"index.d.ts"
910
],
1011
"main": "dist/commonjs/index.js",
1112
"scripts": {

0 commit comments

Comments
 (0)