Skip to content

Commit 41b7eb3

Browse files
committed
wip: Add initial TS typings.
1 parent 55d7b59 commit 41b7eb3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

typings/index.d.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as React from "react"
2+
3+
type ChildrenFunction = (state: object) => React.ReactNode
4+
5+
interface AsyncProps {
6+
children?: React.ReactNode | ChildrenFunction
7+
promiseFn?(props: object): Promise<any>
8+
deferFn?(props: object): Promise<any>
9+
watch?: any
10+
initialValue?: any
11+
onResolve?(data: any): any
12+
onReject?(error: Error): any
13+
}
14+
15+
interface PendingProps {
16+
children?: React.ReactNode | ChildrenFunction
17+
persist?: boolean
18+
}
19+
20+
interface LoadingProps {
21+
children?: React.ReactNode | ChildrenFunction
22+
initial?: boolean
23+
}
24+
25+
interface ResolvedProps {
26+
children?: React.ReactNode | ChildrenFunction
27+
persist?: boolean
28+
}
29+
30+
interface RejectedProps {
31+
children?: React.ReactNode | ChildrenFunction
32+
persist?: boolean
33+
}
34+
35+
declare class Async extends React.Component<AsyncProps, any> {
36+
public static Pending: React.SFC<PendingProps>
37+
public static Loading: React.SFC<LoadingProps>
38+
public static Resolved: React.SFC<ResolvedProps>
39+
public static Rejected: React.SFC<RejectedProps>
40+
}
41+
42+
declare function createInstance(defaultProps?: object): Async
43+
44+
export default createInstance

0 commit comments

Comments
 (0)