diff --git a/alexa-sdk/alexa-sdk-tests.ts b/alexa-sdk/alexa-sdk-tests.ts index c8b2261a39..4a6941b1d0 100644 --- a/alexa-sdk/alexa-sdk-tests.ts +++ b/alexa-sdk/alexa-sdk-tests.ts @@ -1,10 +1,9 @@ /// /// -'use strict'; import Alexa = require("alexa-sdk"); -exports.handler = function(event, context, callback) { +exports.handler = function(event: Alexa.Request, context: Alexa.Context, callback) { var alexa = Alexa.handler(event, context); alexa.registerHandlers(handlers); alexa.execute(); @@ -15,9 +14,9 @@ var handlers = { this.emit('SayHello'); }, 'HelloWorldIntent': function () { - this.emit('SayHello') + this.emit('SayHello'); }, 'SayHello': function () { this.emit(':tell', 'Hello World!'); } -}; \ No newline at end of file +}; diff --git a/alexa-sdk/alexa-sdk.d.ts b/alexa-sdk/alexa-sdk.d.ts index 98a211432c..68c90f1445 100644 --- a/alexa-sdk/alexa-sdk.d.ts +++ b/alexa-sdk/alexa-sdk.d.ts @@ -4,7 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'alexa-sdk' { - var handler: (event: any, context: any, callback?: any) => AlexaHandler; + export function handler(event: Request, context: Context, callback?: () => void): AlexaHandler; + export function CreateStateHandler(state: string, obj: any): any; + export var StateString: string; interface AlexaHandler { _event: any; @@ -14,8 +16,38 @@ declare module 'alexa-sdk' { appId: any; response: any; dynamoDBTableName: any; - saveBeforeResponse: any; - registerHandlers: any; - execute: any; + saveBeforeResponse: boolean; + registerHandlers: (...handlers: any[]) => any; + execute: () => void; + } + + interface Handler { + on: any; + emit: any; + emitWithState: any; + state: any; + handler: any; + event: any; + attributes: any; + context: any; + name: any; + isOverriden: any; + } + + interface Request { + version: string; + request: any; + session: any; + } + + interface Context { + callbackWaitsForEmptyEventLoop: boolean; + logGroupName: string; + logStreamName: string; + functionName: string; + memoryLimitInMB: string; + functionVersion: string; + invokeid: string; + awsRequestId: string; } } \ No newline at end of file