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

Koa + noImplicitAny #292

Closed
timdev opened this issue Sep 27, 2018 · 4 comments
Closed

Koa + noImplicitAny #292

timdev opened this issue Sep 27, 2018 · 4 comments

Comments

@timdev
Copy link

timdev commented Sep 27, 2018

I'm not confident I'm not missing anything, but in my project the compiler is choking on the generated koa routes.ts, complaining that the context and next middleware arguments implicitly have type any.

I see two solutions, both of which may be bad/wrong:

  1. Be explicit about the type of router argument here: https://github.com/lukeautry/tsoa/blob/master/src/routeGeneration/templates/koa.ts#L37 - but I assume it's explicitly any in case you're using some router other than koa-router.

  2. Be explicit about context and next, even if it's just explicit any.

If someone can point me in the right direction, I'd be happy to put together a PR.

@timdev
Copy link
Author

timdev commented Sep 30, 2018

Closing this, as I worked around it by using a custom template that implements the first potential solution I mentioned.

@osdiab
Copy link

osdiab commented Oct 9, 2018

I was experiencing this so I created a quick PR to do what you suggested in #2.

@pjoe
Copy link

pjoe commented Oct 9, 2018

Ran into the same issue, #300 looks like good general fix to me :)

@dgreene1
Copy link
Collaborator

@timdev / @osdiab / @pjoe this fix (#412) is now released in v2.4.7 so you don't need to use a custom template anymore. Also, there were a lot of fantastic improvements that came out in our other releases this week (especially 2.4.4 and 2.4.5 which include automatic controlller crawling and strict input types), so please check out the release notes to see what fun things you can use now. :)

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.

4 participants