-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix Types #117
Fix Types #117
Conversation
On second thought, I pushed a commit to re-add the It's not showing up on this PR yet. I am going to close and re-open this PR to see if I can get it to refresh. I assume it's an issue on GitHub's end. |
that worked 🙂 |
@gr2m, can you take a look at this when you have a minute? |
I updated the CI so that tests should run on PRs as well now 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
If you want, it would be great to add type tests using https://github.com/SamVerschueren/tsd to avoid future regressions. Up to you! This is good to merge as is
Oh, that's interesting. I'll take a look at that sometime. thanks for merging!
|
🎉 This PR is included in version 3.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR fixes the types in
index.d.ts
.Currently, the type signature for
createLambdaFunction
returns a type ofAPIGatewayProxyHandler
which doesn't match its implementation.See the source code for
APIGatewayProxyHandler
here:APIGatewayProxyHandler
(which ultimately usesHandler
, below) - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b384d9e82713dc8400a1289eeb9be7f2fc467390/types/aws-lambda/trigger/api-gateway-proxy.d.ts#L12Handler
- https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b384d9e82713dc8400a1289eeb9be7f2fc467390/types/aws-lambda/handler.d.ts#L83-L88void | Promise<APIGatewayProxyResult>
. both of these items don't matchlambda-function.js
, which only requires two arguments and returns a type ofPromise<APIGatewayProxyResult>
Instead of using
APIGatewayProxyHandler
, I switched the return type to simply be a function which accepts a singleAPIGatewayProxyEvent
argument and returns aPromise<APIGatewayProxyResult>
type.This change also means the unused
context
argument increateLambdaFunction
can be removed.