Skip to content

AsyncConstructor needs to be exported #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nealeu opened this issue Dec 27, 2019 · 0 comments · Fixed by #234
Closed

AsyncConstructor needs to be exported #233

nealeu opened this issue Dec 27, 2019 · 0 comments · Fixed by #234

Comments

@nealeu
Copy link
Contributor

nealeu commented Dec 27, 2019

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

nealeu added a commit to nealeu/react-async that referenced this issue Dec 27, 2019
So that Typescript can generate type declarations

fixes async-library#233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant