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

fix: Koa middleware interface #1242

Merged
merged 1 commit into from
Aug 29, 2020
Merged

fix: Koa middleware interface #1242

merged 1 commit into from
Aug 29, 2020

Conversation

kf6kjg
Copy link
Contributor

@kf6kjg kf6kjg commented Jun 22, 2020

Added the KoaPlaygroundMiddlewareOptions alias so that packages that want to pass around or preset the options don't have to fight the eslint(import/no-extraneous-dependencies) warning.

Fixed the signature of KoaPlaygroundMiddleware to actually match the usage: Koa expects this signature and the previous way was making things mighty hard to use, plus any function that is async is supposed to return a Promise anyway.

I think the tslint hint could be dropped now, but I'm creating this commit from GitHub's interface no I'm not sure. Also I think both KoaPlaygroundMiddleware and Register types could be dropped and the type declarations inlined on the actual lambdas, but I don't know if the extant pattern had a good reason or was just C&P from something else.

Added the KoaPlaygroundMiddlewareOptions alias so that packages that want to pass around or preset the options don't have to fight the `eslint(import/no-extraneous-dependencies)` warning.

Fixed the signature of KoaPlaygroundMiddleware to actually match the usage: Koa expects this signature and the previous way was making things mighty hard to use, plus any function that is async is supposed to return a Promise anyway.

I think the tslint hint could be dropped now, but I'm creating this commit from GitHub's interface no I'm not sure. Also I think both KoaPlaygroundMiddleware and Register types could be dropped and the type declarations inlined on the actual lambdas, but I don't know if the extant pattern had a good reason or was just C&P from something else.
@CLAassistant
Copy link

CLAassistant commented Jun 22, 2020

CLA assistant check
All committers have signed the CLA.

@acao
Copy link
Member

acao commented Aug 29, 2020

thanks! i had to update this for the latest koa, and I haven't used Koa since 1.x ~5 years ago, nor with typescript, so lots has changed!

@acao acao merged commit b596775 into graphql:master Aug 29, 2020
@kf6kjg kf6kjg deleted the patch-1 branch August 30, 2020 03:34
cgxxv pushed a commit to cgxxv/graphql-playground that referenced this pull request Mar 25, 2022
Added the KoaPlaygroundMiddlewareOptions alias so that packages that want to pass around or preset the options don't have to fight the `eslint(import/no-extraneous-dependencies)` warning.

Fixed the signature of KoaPlaygroundMiddleware to actually match the usage: Koa expects this signature and the previous way was making things mighty hard to use, plus any function that is async is supposed to return a Promise anyway.

I think the tslint hint could be dropped now, but I'm creating this commit from GitHub's interface no I'm not sure. Also I think both KoaPlaygroundMiddleware and Register types could be dropped and the type declarations inlined on the actual lambdas, but I don't know if the extant pattern had a good reason or was just C&P from something else.
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 this pull request may close these issues.

3 participants