Skip to content

Commit 6745056

Browse files
matthiskghengeveld
authored andcommitted
Updated TypeScript definitions (#33)
By exporting the `AsyncState` interface we allow users of the library to pass around the `AsyncState` without them having to duplicate the type in their own codebase. With the current type definitions it is not possible to type the parameter of a function to be of type `AsyncState`.
1 parent 2864fb9 commit 6745056

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from "react"
33
type AsyncChildren<T> = ((state: AsyncState<T>) => React.ReactNode) | React.ReactNode
44
type PromiseFn<T> = (props: object) => Promise<T>
55

6-
interface AsyncOptions<T> {
6+
export interface AsyncOptions<T> {
77
promise?: Promise<T>
88
promiseFn?: (props: object, controller: AbortController) => Promise<T>
99
deferFn?: (args: any[], props: object, controller: AbortController) => Promise<T>
@@ -19,7 +19,7 @@ interface AsyncProps<T> extends AsyncOptions<T> {
1919
children?: AsyncChildren<T>
2020
}
2121

22-
interface AsyncState<T> {
22+
export interface AsyncState<T> {
2323
data?: T
2424
error?: Error
2525
initialValue?: T

0 commit comments

Comments
 (0)