Skip to content

Commit 78b3f71

Browse files
committed
Flow typing for decorator function.
1 parent 449db1a commit 78b3f71

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"babel-core": "^6.25.0",
4141
"babel-loader": "^7.1.1",
4242
"babel-runtime": "^6.23.0",
43+
"flow-bin": "^0.57.3",
4344
"prop-types": "^15.5.10",
45+
"react": "^16.0.0",
4446
"webpack": "^3.3.0"
4547
},
4648
"peerDependencies": {

src/ErrorBoundary.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ type ErrorInfo = {
1616
type State = {
1717
error: ?Error,
1818
info: ?ErrorInfo,
19-
};
19+
}
2020

21-
class ErrorBoundary extends Component {
21+
class ErrorBoundary extends Component<Props, State> {
2222
props: Props;
2323
state: State;
2424

25+
setState: Function
26+
2527
static defaultProps = {
2628
FallbackComponent: ErrorBoundaryFallbackComponent,
2729
};
@@ -68,10 +70,10 @@ class ErrorBoundary extends Component {
6870

6971

7072
export const withErrorBoundary: Function = (
71-
Component: *,
72-
FallbackComponent: *,
73+
Component: Class<React.Component<*>>,
74+
FallbackComponent: Class<React.Component<*>>,
7375
onError: Function
74-
): Function => (props: *): * => (
76+
): Function => props => (
7577
<ErrorBoundary FallbackComponent={FallbackComponent} onError={onError}>
7678
<Component {...props} />
7779
</ErrorBoundary>

0 commit comments

Comments
 (0)