From 1af69c47fbade23fe06ac287c1ca7d5a5f6c5c2f Mon Sep 17 00:00:00 2001 From: Yoriki Yamaguchi Date: Sat, 7 Jan 2017 22:01:39 +0900 Subject: [PATCH] fix type definition for package: apex.js (#13825) * fix `export default` issue * use `namespace` instead of (internal) `module` * write it as an external module --- apex.js/apex.js-tests.ts | 9 ++++++--- apex.js/index.d.ts | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apex.js/apex.js-tests.ts b/apex.js/apex.js-tests.ts index e42528d180..0595ef43ea 100644 --- a/apex.js/apex.js-tests.ts +++ b/apex.js/apex.js-tests.ts @@ -1,5 +1,8 @@ -import λ from "apex.js"; +import * as λ from "apex.js"; -const handler = λ(event => { - console.log("Invoked with event " + JSON.stringify(event)); +const handler = λ((event, context) => { + console.log("Event: " + JSON.stringify(event)); + console.log("Context: " + JSON.stringify(context)); + + return {event, context}; }); diff --git a/apex.js/index.d.ts b/apex.js/index.d.ts index 54f70e1a7e..20178369dc 100644 --- a/apex.js/index.d.ts +++ b/apex.js/index.d.ts @@ -5,4 +5,6 @@ /// -export default function λ(fn: (event: any, context: AWSLambda.Context) => any): (event: any, context: AWSLambda.Context, callback: AWSLambda.Callback) => void; +declare function λ(fn: (event: any, context: AWSLambda.Context) => any): (event: any, context: AWSLambda.Context, callback: AWSLambda.Callback) => void; +declare namespace λ {} +export = λ;