koajs / koa-body

koa body parser middleware
MIT License
950 stars 130 forks source link

The type declaration file made it impossible for me to use generics, so I temporarily removed it #198

Open wwog opened 3 years ago

wwog commented 3 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch koa-body@4.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/koa-body/index.d.ts b/node_modules/koa-body/index.d.ts
index 02afce3..f01523e 100644
--- a/node_modules/koa-body/index.d.ts
+++ b/node_modules/koa-body/index.d.ts
@@ -1,12 +1,15 @@
 import * as Koa from "koa";
 import { Files } from 'formidable';

+/* 
+This code overrides koA's type file, which prevents me from using generics properly in KOA
 declare module "koa" {
     interface Request extends Koa.BaseRequest {
         body?: any;
         files?: Files;
     }
 }
+ */

 declare namespace koaBody {
     interface IKoaBodyFormidableOptions {

This issue body was partially generated by patch-package.