From 9e02b7160d1ae89e4778e1bf7c07dab63beb576a Mon Sep 17 00:00:00 2001 From: Yoriki Yamaguchi Date: Sat, 7 Jan 2017 01:30:54 +0900 Subject: [PATCH] add type definition for package: apex.js (#13796) * add apex.js * 4 spaces * fix `implicitly has any type` * match the style of tslint.json * make `event` and `context` not optional * avoid annotating the types of callbacks manually --- apex.js/apex.js-tests.ts | 5 +++++ apex.js/index.d.ts | 8 ++++++++ apex.js/tsconfig.json | 20 ++++++++++++++++++++ apex.js/tslint.json | 1 + 4 files changed, 34 insertions(+) create mode 100644 apex.js/apex.js-tests.ts create mode 100644 apex.js/index.d.ts create mode 100644 apex.js/tsconfig.json create mode 100644 apex.js/tslint.json diff --git a/apex.js/apex.js-tests.ts b/apex.js/apex.js-tests.ts new file mode 100644 index 0000000000..e42528d180 --- /dev/null +++ b/apex.js/apex.js-tests.ts @@ -0,0 +1,5 @@ +import λ from "apex.js"; + +const handler = λ(event => { + console.log("Invoked with event " + JSON.stringify(event)); +}); diff --git a/apex.js/index.d.ts b/apex.js/index.d.ts new file mode 100644 index 0000000000..54f70e1a7e --- /dev/null +++ b/apex.js/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for apex.js 2.0 +// Project: https://github.com/apex/node-apex +// Definitions by: Yoriki Yamaguchi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export default function λ(fn: (event: any, context: AWSLambda.Context) => any): (event: any, context: AWSLambda.Context, callback: AWSLambda.Callback) => void; diff --git a/apex.js/tsconfig.json b/apex.js/tsconfig.json new file mode 100644 index 0000000000..835b16d90b --- /dev/null +++ b/apex.js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "apex.js-tests.ts" + ] +} diff --git a/apex.js/tslint.json b/apex.js/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/apex.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file