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-better-body types are broken #150

Open
stevebaxter opened this issue Jul 23, 2020 · 10 comments
Open

koa-better-body types are broken #150

stevebaxter opened this issue Jul 23, 2020 · 10 comments

Comments

@stevebaxter
Copy link

stevebaxter commented Jul 23, 2020

Support plan

  • which support plan is this issue covered by? (e.g. Community, Sponsor, or
    Enterprise): Community
  • is this issue currently blocking your project? (no): no
  • is this issue affecting a production system? (no): no

Context

  • node version: 12.16.3
  • module version: koa-better-body 3.3.9
  • environment (e.g. node, browser, native): node
  • used with (i.e. popular names of modules): Koa
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

Use koa-better-body with typescript

What was the result you got?

@types/koa-better-body says that types are already included with koa-better-body but they are not

What result did you expect?

A type definition file, either at koa-better-body or at @types/koa-better-body

@auto-comment
Copy link

auto-comment bot commented Jul 23, 2020

Thank you for raising this issue! We will try and get back to you as soon as possible.
Please make sure you format it properly, followed our code of conduct, and have given us as much context as possible.
Hey @tunnckoCore, check out this one too! ;)

@stevebaxter stevebaxter changed the title koa-better-body type are broken koa-better-body types are broken Jul 23, 2020
@tunnckoCore
Copy link
Owner

Hi there. I think I received such issue previously. I think there was a PR there to revert back to the old version. Can't follow now, probably in the coming days.

The v3.2.x is nothing new. You can use the 3.1.x or 3.0.x types.

@stevebaxter
Copy link
Author

There are 3.0 types but they don't seem to be complete. I ended up using a different solution, thought I would let you know though!

@tunnckoCore
Copy link
Owner

tunnckoCore commented Jul 28, 2020

Yea, thanks, I should fix that. I had it in mind.

@macsj200
Copy link

I'm also running into this issue. I was using 3.0.4 and the types did not seem to be included. I also tried using 3.3.9 and 3.1.15.

@stevebaxter what was the different solution you found?

@tunnckoCore
Copy link
Owner

@macsj200 I was using 3.0.4

Just continue using them? Nothing has changed in the versions from last year, year-and-a-half.

@stevebaxter
Copy link
Author

@macsj200 - I needed the raw body, I ended up unpacking it myself with raw-body, e.g.:

import getRawBody from "raw-body";
.
.
.
  public async handleRequest(ctx: Context): Promise<void> {
    const rawBody = await getRawBody(ctx.req, { limit: "50mb", length: ctx.request.length });

    // Do something with the raw body...
  }

@macsj200
Copy link

@tunnckoCore when you say "continue using them" what do you mean? Like I said, the types did not seem to be included in 3.0.4.

@tunnckoCore
Copy link
Owner

Ah sorry, misread it.

@macsj200
Copy link

No worries, let me know if there's a solution you can think of or if you think I'm just doing something wrong.

Currently I'm thinking I will just have to shoehorn some custom types in the app code and use as typecasts to get around these issues, but obviously it's much cleaner to use the library-supplied types where possible.

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

3 participants