Skip to content
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

Use TypeScript 2.8's inferred types to make the dataloaders autocomplete #983

Open
orta opened this issue Mar 28, 2018 · 0 comments
Open

Comments

@orta
Copy link
Contributor

orta commented Mar 28, 2018

We can use

type ReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : any;

to get the return type of all our dataloaders.

screen shot 2018-03-27 at 11 01 02 pm

and give it a name. Then we can do a declare of some sort for a resolver to attach that as context where we use it in the params.

@orta orta changed the title Use TypeScript 2.8's inferred types to make the dataloadesr autocomplete Use TypeScript 2.8's inferred types to make the dataloaders autocomplete Apr 10, 2018
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

No branches or pull requests

1 participant