Skip to content

Commit dc9eac7

Browse files
committed
Fix type definition for createInstance.
1 parent 34e79ee commit dc9eac7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/react-async/src/index.d.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,17 @@ declare namespace Async {
135135
export function Settled<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
136136
}
137137

138-
export function createInstance<T>(defaultProps?: AsyncProps<T>): Async<T>
138+
export function createInstance<T>(
139+
defaultProps?: AsyncProps<T>
140+
): (new () => Async<T>) & {
141+
Initial<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
142+
Pending<T>(props: { children?: AsyncChildren<T>; initial?: boolean }): JSX.Element
143+
Loading<T>(props: { children?: AsyncChildren<T>; initial?: boolean }): JSX.Element
144+
Fulfilled<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
145+
Resolved<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
146+
Rejected<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
147+
Settled<T>(props: { children?: AsyncChildren<T>; persist?: boolean }): JSX.Element
148+
}
139149

140150
export function useAsync<T>(
141151
arg1: AsyncOptions<T> | PromiseFn<T>,

0 commit comments

Comments
 (0)