jeremydaly / lambda-api

Lightweight web framework for your serverless applications
https://serverless-api.com
MIT License
1.42k stars 126 forks source link

fix(types): resolve use func not allowing to mix middlewares #183

Closed michaeleliot closed 1 year ago

michaeleliot commented 3 years ago

Currently the use function allows for inputs to be either Middleware or ErrorHandlingMiddleware. However, the typescript type requires the list of arguments to be only Middleware or only ErrorHandlingMiddleware. I.e. you couldn't call api.use with both error middleware and normal middleware. This pr brings the typescript type back into line with code expectation.

Code Section in question: https://github.com/jeremydaly/lambda-api/blob/c1fe83e53d56eb23c4ef755c01bf1ebc07a7c342/index.js#L355-L383

naorpeled commented 1 year ago

Hey @michaeleliot, thanks for your contribution, you're awesome 😎