koa-modules / multer

Middleware for handling `multipart/form-data` for koa, based on Express's multer.
MIT License
264 stars 26 forks source link

Please add .d.ts file to this project to support typescript #20

Open tangxinyao opened 7 years ago

tangxinyao commented 7 years ago

Some problems come to me when I try to use typescript to write my web app, so i wonder if you could write an index.d.ts file for this project to support vscode intellisense or make it easy for us to write code by typescript?

Poseiden commented 7 years ago

l agree that. l also have to handle file uploading in koa2 with typescript. But l can't find type definition file for this module. Have you accomplished that ?

benstevens48 commented 6 years ago

Hi, I just submitted type definitions to DefinitelyTyped. They can be found on npm at @types/koa-multer. Note that to use the extra properties added to the ctx.req object (e.g. files) you have to do an explicit cast as follows (<multer.MulterIncomingMessage>ctx.req). The type cast is necessary since the type definitions for Koa do not allow for the ctx.req property to be extended.

kiramishima commented 6 years ago

Nice @benstevens48 cast, solves ctx.req.file or files :) Merci Beaucoup