mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Adding duck typed Promise Interface
This commit is contained in:
Vendored
+6
-6
@@ -7,10 +7,6 @@
|
||||
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
declare module "hapi" {
|
||||
import http = require("http");
|
||||
@@ -21,6 +17,10 @@ declare module "hapi" {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
|
||||
}
|
||||
|
||||
/** Boom Module for errors. https://github.com/hapijs/boom
|
||||
* boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */
|
||||
export interface IBoom extends Error {
|
||||
@@ -234,12 +234,12 @@ declare module "hapi" {
|
||||
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
|
||||
export interface IReply {
|
||||
<T>(err: Error,
|
||||
result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T,
|
||||
result?: string|number|boolean|Buffer|stream.Stream | IPromise<T> | T,
|
||||
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
|
||||
credentialData?: any
|
||||
): IBoom;
|
||||
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
|
||||
<T>(result: string|number|boolean|Buffer|stream.Stream | Promise<T> | T): Response;
|
||||
<T>(result: string|number|boolean|Buffer|stream.Stream | IPromise<T> | T): Response;
|
||||
|
||||
/** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200.
|
||||
* The data argument is only used for passing back authentication data and is ignored elsewhere. */
|
||||
|
||||
Reference in New Issue
Block a user