lambda-tester icon indicating copy to clipboard operation
lambda-tester copied to clipboard

TypeScript definitions

Open jovanmilenkoski opened this issue 5 years ago • 4 comments

Really nice helper, using this in my project a lot. But should I expect TypeScript definitions anytime soon?

jovanmilenkoski avatar Sep 28 '18 07:09 jovanmilenkoski

I stumbled on this package too and missed not having types for it. Opened a PR on DefinitelyTyped about it which just got merged, it should be in the npmjs registry in a couple of hours.

ivank avatar Oct 02 '18 06:10 ivank

@ivank : awesome, thanks!

HajoAhoMantila avatar Oct 09 '18 07:10 HajoAhoMantila

Is there any way to add noVersionCheck ?

moikot avatar Apr 05 '19 20:04 moikot

@ivank I'm having a bad time with "@types/lambda-tester": "^3.6.0"

My tests keep failing with "error TS7006: Parameter 'result' implicitly has an 'any' type." I have no idea how to make this error go away. I hope you can help?

Here's what my simple unit test looks like (I'm using Jest):

 test("Access via GET is not allowed", async () => {
   await LambdaTester(handler)
     .event({ httpMethod: "GET" } as APIGatewayProxyEvent)
     .expectResult((result) => {
       return expect(result).toEqual({
         body: '{"error":"POST requests only"}',
         headers: {
           "Content-Type": "application/json"
         },
         statusCode: 405
       });
     });
 });

My workaround it to uninstall @types/lambda-tester and create blank declaration file with declare module "lambda-tester"; inside it.

chiubaca avatar Jun 21 '20 12:06 chiubaca