Skip to content

Add TypeScript support for api.require and custom middleware - #1

Open
jsepia wants to merge 5 commits into
maxmellen:masterfrom
jsepia:master
Open

Add TypeScript support for api.require and custom middleware#1
jsepia wants to merge 5 commits into
maxmellen:masterfrom
jsepia:master

Conversation

@jsepia

@jsepia jsepia commented Jun 6, 2019

Copy link
Copy Markdown

I ran into a TypeScript error while trying to write a custom middleware:

import { Middleware, Request, Response } from 'lambda-api'

const myMiddleware: Middleware = (req: Request, res: Response, next: Middleware) => {
  console.log(req)
  next() // Expected 3 arguments, but got 0
}

export default myMiddleware

My PR fixes this by making the arguments in Middleware optional.

And I needed TS support for require so I added it.

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 this pull request may close these issues.

1 participant