async-library / react-async

🍾 Flexible promise-based React data loader

Home Page:https://docs.react-async.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncConstructor needs to be exported

nealeu opened this issue · comments

Typescript emits TS4023 error because it cannot find the 'shape' of the function when emitting type declarations. Exporting AsyncConstructor solves this.

For example when I write:

import {createInstance} from "react-async";
export const AsyncData = createInstance<MyData>({});

Typescript wants to generate:

export declare const AsyncData: import("react-async").AsyncConstructor<MyData>;

However this is not possible because AsyncConstructor is not exported