Skip to content

Commit 5d545c9

Browse files
committed
add missing exports, lint
1 parent 70393af commit 5d545c9

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"start": "run-p start:*",
1616
"start:examples": "now dev",
1717
"start:storybook": "start-storybook -p 6006",
18-
"lint": "eslint packages/*/src/*.{j,t}{s,sx}",
18+
"lint": "eslint packages/*/src/*.{js,ts,tsx}",
1919
"test": "jest packages/*/src/*.spec.js",
2020
"test:watch": "yarn test -- --watch",
2121
"test:devtools": "jest react-async-devtools/src",
@@ -76,4 +76,4 @@
7676
"react-dom": "16.9.0",
7777
"storybook-chromatic": "2.2.2"
7878
}
79-
}
79+
}

packages/react-async/src/helpers.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
* AbstractState imported in this file, even though it is only used implicitly.
1717
* This _uses_ AbstractState so it is not accidentally removed by someone.
1818
*/
19-
declare type ImportWorkaround<T> = AbstractState<T>;
19+
declare type ImportWorkaround<T> = AbstractState<T>
2020

2121
// these were exported as type, but never existed
2222
// export declare function IfLoading<T>(props: {
@@ -88,8 +88,8 @@ export const IfFulfilled = <T extends {}>({
8888
persist?: boolean
8989
state: AsyncState<T>
9090
}) => (
91-
<>{state.isFulfilled || (persist && state.data) ? renderFn(children, state.data, state) : null}</>
92-
)
91+
<>{state.isFulfilled || (persist && state.data) ? renderFn(children, state.data, state) : null}</>
92+
)
9393

9494
/**
9595
* Renders only when promise is rejected.
@@ -107,10 +107,10 @@ export const IfRejected = <T extends {}>({
107107
persist?: boolean
108108
state: AsyncState<T>
109109
}) => (
110-
<>
111-
{state.isRejected || (persist && state.error) ? renderFn(children, state.error, state) : null}
112-
</>
113-
)
110+
<>
111+
{state.isRejected || (persist && state.error) ? renderFn(children, state.error, state) : null}
112+
</>
113+
)
114114

115115
/**
116116
* Renders only when promise is fulfilled or rejected.

packages/react-async/src/index.ts

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
import Async from "./Async"
2-
export { default as Async, createInstance } from "./Async"
3-
export { default as useAsync, useFetch } from "./useAsync"
2+
export {
3+
default as Async,
4+
createInstance,
5+
PromiseFn,
6+
InitialChildren,
7+
PendingChildren,
8+
FulfilledChildren,
9+
Start,
10+
Cancel,
11+
Reject,
12+
AsyncProps,
13+
RejectedChildren,
14+
SettledChildren,
15+
DeferFn,
16+
Fulfill,
17+
AsyncAction,
18+
AbstractState,
19+
AsyncInitial,
20+
AsyncPending,
21+
AsyncFulfilled,
22+
AsyncChildren,
23+
AsyncOptions,
24+
AsyncRejected,
25+
AsyncState,
26+
} from "./Async"
27+
export { default as useAsync, useFetch, FetchOptions } from "./useAsync"
428
export default Async
529
export { statusTypes } from "./status"
630
export { default as globalScope } from "./globalScope"
731
export * from "./helpers"
832
export * from "./reducer"
33+
34+
/*
35+
> RejectedChildren
36+
> SettledChildren
37+
> PromiseFn
38+
> DeferFn
39+
> Fulfill
40+
> AsyncAction
41+
> AbstractState
42+
> AsyncInitial
43+
> AsyncPending
44+
> AsyncFulfilled
45+
> AsyncInitialWithout
46+
*/

packages/react-async/src/reducer.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
* AbstractState imported in this file, even though it is only used implicitly.
1616
* This _uses_ AbstractState so it is not accidentally removed by someone.
1717
*/
18-
declare type ImportWorkaround<T> = AbstractState<T>;
19-
18+
declare type ImportWorkaround<T> = AbstractState<T>
2019

2120
export enum actionTypes {
2221
start = "start",

0 commit comments

Comments
 (0)