Add type definitions for cfn-response package.

This commit is contained in:
Ivo Murrell
2018-12-01 02:32:31 +00:00
parent efbcbdebaf
commit c679a8e691
4 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import * as cfn from "cfn-response";
import { CloudFormationCustomResourceEvent, Context } from "aws-lambda";
declare const event: CloudFormationCustomResourceEvent;
declare const context: Context;
// $ExpectType void
cfn.send(event, context, cfn.SUCCESS, { sample: 123 }, "abc");
// $ExpectType void
cfn.send(event, context, "SUCCESS");
// $ExpectError
cfn.send(event, context, "", {});

19
types/cfn-response/index.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
// Type definitions for cfn-response 1.0
// Project: https://github.com/LukeMizuhashi/cfn-response
// Definitions by: Ivo Murrell <https://github.com/ivoisbelongtous>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { CloudFormationCustomResourceEvent, Context } from "aws-lambda";
export type ResponseStatus = "SUCCESS" | "FAILED";
export const SUCCESS: ResponseStatus;
export const FAILED: ResponseStatus;
export function send(
event: CloudFormationCustomResourceEvent,
context: Context,
responseStatus: ResponseStatus,
responseData?: object,
physicalResourceId?: string
): void;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cfn-response-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }