From a8ea2310646a5d0cabedcc0ba9542ab5703ea8ca Mon Sep 17 00:00:00 2001 From: Neale Upstone Date: Tue, 31 Dec 2019 15:55:40 +0000 Subject: [PATCH 1/2] Export Props interfaces to allow exported declarations Otherwise we get: TS4023: Exported variable 'MyAsync' has or is using name 'PendingProps' from external module "/node_modules/react-async/dist-types/index" but cannot be named. --- packages/react-async/src/Async.tsx | 10 +++++----- packages/react-async/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-async/src/Async.tsx b/packages/react-async/src/Async.tsx index 104fa50d..5d0559e7 100644 --- a/packages/react-async/src/Async.tsx +++ b/packages/react-async/src/Async.tsx @@ -22,23 +22,23 @@ import { ReducerAsyncState, } from "./types" -interface InitialProps { +export interface InitialProps { children?: InitialChildren persist?: boolean } -interface PendingProps { +export interface PendingProps { children?: PendingChildren initial?: boolean } -interface FulfilledProps { +export interface FulfilledProps { children?: FulfilledChildren persist?: boolean } -interface RejectedProps { +export interface RejectedProps { children?: RejectedChildren persist?: boolean } -interface SettledProps { +export interface SettledProps { children?: SettledChildren persist?: boolean } diff --git a/packages/react-async/src/index.ts b/packages/react-async/src/index.ts index e35a81b0..51d46e87 100644 --- a/packages/react-async/src/index.ts +++ b/packages/react-async/src/index.ts @@ -1,5 +1,5 @@ import Async from "./Async" -export { default as Async, createInstance } from "./Async" +export { default as Async, createInstance, AsyncConstructor, FulfilledProps, InitialProps, PendingProps, RejectedProps, SettledProps } from "./Async" export * from "./types" export { default as useAsync, useFetch, FetchOptions, FetchError } from "./useAsync" export default Async From 5ffaab296ae5e9a6276b30a3d3ae0fc5601ad2fe Mon Sep 17 00:00:00 2001 From: Neale Upstone Date: Tue, 31 Dec 2019 17:42:10 +0000 Subject: [PATCH 2/2] Fix prettier complaining about long export --- packages/react-async/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-async/src/index.ts b/packages/react-async/src/index.ts index 51d46e87..1d38c448 100644 --- a/packages/react-async/src/index.ts +++ b/packages/react-async/src/index.ts @@ -1,5 +1,14 @@ import Async from "./Async" -export { default as Async, createInstance, AsyncConstructor, FulfilledProps, InitialProps, PendingProps, RejectedProps, SettledProps } from "./Async" +export { + default as Async, + createInstance, + AsyncConstructor, + FulfilledProps, + InitialProps, + PendingProps, + RejectedProps, + SettledProps, +} from "./Async" export * from "./types" export { default as useAsync, useFetch, FetchOptions, FetchError } from "./useAsync" export default Async