Skip to content

Commit

Permalink
Fix #1038 by making the AwsLambdaReceiver example TS compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Aug 5, 2021
1 parent 08b50ca commit afebfcc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/deploy-aws-lambda/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ app.message('goodbye', async ({ message, say }) => {

// Handle the Lambda function event
module.exports.handler = async (event, context, callback) => {
const handler = await app.start();
const handler = await awsLambdaReceiver.start();
return handler(event, context, callback);
}
1 change: 1 addition & 0 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ export default class App {
public start(
...args: Parameters<HTTPReceiver['start'] | SocketModeReceiver['start']>
): ReturnType<HTTPReceiver['start']> {
// TODO: HTTPReceiver['start'] should be the actual receiver's return type
return this.receiver.start(...args) as ReturnType<HTTPReceiver['start']>;
}

Expand Down
3 changes: 2 additions & 1 deletion src/receivers/AwsLambdaReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import AwsLambdaReceiver from './AwsLambdaReceiver';
import crypto from 'crypto';
import rewiremock from 'rewiremock';
import { WebClientOptions } from '@slack/web-api';
import { AwsHandler } from './AwsLambdaReceiver';

describe('AwsLambdaReceiver', function () {
beforeEach(function () {});
Expand Down Expand Up @@ -48,7 +49,7 @@ describe('AwsLambdaReceiver', function () {
const awsReceiver = new AwsLambdaReceiver({
signingSecret: 'my-secret',
});
const handler = await awsReceiver.start();
const handler: AwsHandler = await awsReceiver.start();
assert.isNotNull(handler);
});

Expand Down

0 comments on commit afebfcc

Please sign in to comment.