Skip to content

Commit 70393af

Browse files
committed
hotfix for type generation
1 parent 0321c69 commit 70393af

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

Diff for: packages/react-async/src/helpers.tsx

+14-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ import {
88
RejectedChildren,
99
SettledChildren,
1010
AsyncState,
11+
AbstractState,
1112
} from "./Async"
1213

14+
/**
15+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
16+
* AbstractState imported in this file, even though it is only used implicitly.
17+
* This _uses_ AbstractState so it is not accidentally removed by someone.
18+
*/
19+
declare type ImportWorkaround<T> = AbstractState<T>;
20+
1321
// these were exported as type, but never existed
1422
// export declare function IfLoading<T>(props: {
1523
// children?: PendingChildren<T>
@@ -80,8 +88,8 @@ export const IfFulfilled = <T extends {}>({
8088
persist?: boolean
8189
state: AsyncState<T>
8290
}) => (
83-
<>{state.isFulfilled || (persist && state.data) ? renderFn(children, state.data, state) : null}</>
84-
)
91+
<>{state.isFulfilled || (persist && state.data) ? renderFn(children, state.data, state) : null}</>
92+
)
8593

8694
/**
8795
* Renders only when promise is rejected.
@@ -99,10 +107,10 @@ export const IfRejected = <T extends {}>({
99107
persist?: boolean
100108
state: AsyncState<T>
101109
}) => (
102-
<>
103-
{state.isRejected || (persist && state.error) ? renderFn(children, state.error, state) : null}
104-
</>
105-
)
110+
<>
111+
{state.isRejected || (persist && state.error) ? renderFn(children, state.error, state) : null}
112+
</>
113+
)
106114

107115
/**
108116
* Renders only when promise is fulfilled or rejected.

Diff for: packages/react-async/src/reducer.ts

+9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ import {
77
AsyncFulfilled,
88
AsyncRejected,
99
AsyncInitial,
10+
AbstractState,
1011
} from "./Async"
1112

13+
/**
14+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
15+
* AbstractState imported in this file, even though it is only used implicitly.
16+
* This _uses_ AbstractState so it is not accidentally removed by someone.
17+
*/
18+
declare type ImportWorkaround<T> = AbstractState<T>;
19+
20+
1221
export enum actionTypes {
1322
start = "start",
1423
cancel = "cancel",

0 commit comments

Comments
 (0)