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

Provide generic type params #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Provide generic type params #197

wants to merge 1 commit into from

Conversation

gao-sun
Copy link

@gao-sun gao-sun commented Jul 6, 2021

Currently the return type of koaBody() has been fixed to Koa.Middleware<{}, {}>, which will be problematic if we would like to provide a different type combo, e.g.:

koaBody<{ userId: string }, ContextT, { status: number }>()

this pr will fix this issue by providing generic type params:

image

since koaBody() will inject body and files into ctx.request directly, it'll be fine to just keep the same input type combo for the return middleware function.

@gao-sun gao-sun changed the title wip: provide generic type defs Provide generic type defs Jul 6, 2021
@gao-sun gao-sun changed the title Provide generic type defs Provide generic type params Jul 6, 2021
@gao-sun gao-sun marked this pull request as ready for review July 6, 2021 06:57
@gao-sun
Copy link
Author

gao-sun commented Jul 6, 2021

@MarkHerhold would you mind to take a look? thanks

@DavidTanner
Copy link
Contributor

@MarkHerhold @dlau I would like these to be merged in as well

@MarkHerhold
Copy link
Contributor

This should be at least partially addressed by #213

@DavidTanner
Copy link
Contributor

I'll check that out

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