From afebfccbc47f76f5bb04a46bb0b2d841a5cf727e Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Fri, 6 Aug 2021 07:30:25 +0900 Subject: [PATCH] Fix #1038 by making the AwsLambdaReceiver example TS compatible --- examples/deploy-aws-lambda/app.js | 2 +- src/App.ts | 1 + src/receivers/AwsLambdaReceiver.spec.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/deploy-aws-lambda/app.js b/examples/deploy-aws-lambda/app.js index 87e7fd972..926f19677 100644 --- a/examples/deploy-aws-lambda/app.js +++ b/examples/deploy-aws-lambda/app.js @@ -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); } diff --git a/src/App.ts b/src/App.ts index b5d98931c..cb60409fc 100644 --- a/src/App.ts +++ b/src/App.ts @@ -433,6 +433,7 @@ export default class App { public start( ...args: Parameters ): ReturnType { + // TODO: HTTPReceiver['start'] should be the actual receiver's return type return this.receiver.start(...args) as ReturnType; } diff --git a/src/receivers/AwsLambdaReceiver.spec.ts b/src/receivers/AwsLambdaReceiver.spec.ts index 76b5ffbf2..87c790ee7 100644 --- a/src/receivers/AwsLambdaReceiver.spec.ts +++ b/src/receivers/AwsLambdaReceiver.spec.ts @@ -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 () {}); @@ -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); });