probot / adapter-aws-lambda-serverless

An extension for running Probot on Lambda
ISC License
94 stars 36 forks source link

Fix Types #117

Closed ajschmidt8 closed 1 year ago

ajschmidt8 commented 1 year ago

This PR fixes the types in index.d.ts.

Currently, the type signature for createLambdaFunction returns a type of APIGatewayProxyHandler which doesn't match its implementation.

See the source code for APIGatewayProxyHandler here:

Instead of using APIGatewayProxyHandler, I switched the return type to simply be a function which accepts a single APIGatewayProxyEvent argument and returns a Promise<APIGatewayProxyResult> type.

This change also means the unused context argument in createLambdaFunction can be removed.

ajschmidt8 commented 1 year ago

On second thought, I pushed a commit to re-add the context argument with associated types. This will be helpful in case the argument is ever used in the future.

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.

ajschmidt8 commented 1 year ago

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 :slightly_smiling_face:

ajschmidt8 commented 1 year ago

@gr2m, can you take a look at this when you have a minute?

gr2m commented 1 year ago

I updated the CI so that tests should run on PRs as well now 👍🏼

ajschmidt8 commented 1 year ago

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!

GitHub
GitHub - SamVerschueren/tsd: Check TypeScript type definitions
Check TypeScript type definitions. Contribute to SamVerschueren/tsd development by creating an account on GitHub.
github-actions[bot] commented 1 year ago

:tada: This PR is included in version 3.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: