Skip to content
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

Align Callback with @types/aws-lambda #1353

Merged
merged 3 commits into from
Apr 14, 2021

Conversation

h-kishi
Copy link
Contributor

@h-kishi h-kishi commented Apr 6, 2021

Goal

The goal is to align the callback types of @bugsnag/plugin-aws-lambda and @types/aws-lambda.
@types/aws-lambda is often used to develop lambda functions with TypeScript.
The type of lambda callback is defined in @types/aws-lambda, but the type is different from the callback of CallbackHandler in @bugsnag/plugin-aws-lambda.

type CallbackHandler = (event: any, context: any, callback: (err: Error|null, response: any) => void) => void

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b9b6b0e9bd5de6ed18be0a3e07816f60fe6f2cfa/types/aws-lambda/handler.d.ts#L171

export type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void;

(I guess that this is the cause of #1344)

Testing

I added a test for the pattern of passing a string to a callback.

@johnkiely1
Copy link
Member

Hey @h-kishi,

Thanks for this, we will look to get this reviewed as soon as priorities allow.

Copy link
Contributor

@imjoehaines imjoehaines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @h-kishi!

Can confirm this fixes #1344

@imjoehaines imjoehaines merged commit 02730ba into bugsnag:next Apr 14, 2021
@imjoehaines imjoehaines mentioned this pull request Apr 16, 2021
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.

3 participants