mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* fix incorrect return values for aws-serverless-express proxy proxy() returns a ProxyResult as long as resolutionMode is provided. https://github.com/awslabs/aws-serverless-express/blob/master/src/index.js#L210 As it is now, the types are misleading and prevent you from awaiting the promise, which is required for it all to work. * Update aws-serverless-express/index to make unified-signatures pass https://travis-ci.org/DefinitelyTyped/DefinitelyTyped/builds/526699822#L572
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
// Type definitions for aws-serverless-express 3.3
|
|
// Project: https://github.com/awslabs/aws-serverless-express
|
|
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
|
// Josh Caffey <https://github.com/jcaffey>
|
|
// Matthias Meyer <https://github.com/mattmeye>
|
|
// Alberto Vasquez <https://github.com/albertovasquez>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.3
|
|
|
|
/// <reference types="node"/>
|
|
import * as http from 'http';
|
|
import * as lambda from 'aws-lambda';
|
|
|
|
export interface Response {
|
|
statusCode: number;
|
|
body: string;
|
|
headers: {};
|
|
}
|
|
|
|
export interface ProxyResult {
|
|
promise: Promise<Response>;
|
|
}
|
|
|
|
export function createServer(
|
|
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => void,
|
|
serverListenCallback?: () => any,
|
|
binaryMimeTypes?: string[]
|
|
): http.Server;
|
|
|
|
export function proxy(
|
|
server: http.Server,
|
|
event: any,
|
|
context: lambda.Context,
|
|
): http.Server;
|
|
|
|
export function proxy(
|
|
server: http.Server,
|
|
event: any,
|
|
context: lambda.Context,
|
|
resolutionMode: 'CONTEXT_SUCCEED' | 'PROMISE',
|
|
): ProxyResult;
|
|
|
|
export function proxy(
|
|
server: http.Server,
|
|
event: any,
|
|
context: lambda.Context,
|
|
resolutionMode: 'CALLBACK',
|
|
callback?: (error: any, response: Response) => void
|
|
): ProxyResult;
|