mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 09:01:45 +08:00
Support for hapijs/boom library
This commit is contained in:
7
boom/boom-tests.ts
Normal file
7
boom/boom-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference path="boom.d.ts" />
|
||||
|
||||
import Boom = require('boom');
|
||||
|
||||
Boom.create(500, 'Internal server error', { timestamp: Date.now() });
|
||||
Boom.wrap(new Error('test'), 400);
|
||||
Boom.badRequest('Invalid cookies');
|
||||
32
boom/boom.d.ts
vendored
Normal file
32
boom/boom.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Type definitions for boom
|
||||
// Project: http://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <http://github.com/rogatty>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module Boom {
|
||||
interface BoomError {
|
||||
data: any;
|
||||
reformat: () => void;
|
||||
isBoom: boolean;
|
||||
isServer: boolean;
|
||||
message: string;
|
||||
output: Output;
|
||||
}
|
||||
|
||||
export interface Output {
|
||||
statusCode: number;
|
||||
headers: any;
|
||||
payload: any;
|
||||
}
|
||||
|
||||
export function wrap(error: Error, statusCode?: number, message?: string): BoomError;
|
||||
export function create(statusCode: number, message?: string, data?: any): BoomError;
|
||||
|
||||
export function badRequest(message?: string, data?: any): BoomError;
|
||||
}
|
||||
|
||||
declare module "boom" {
|
||||
export = Boom;
|
||||
}
|
||||
Reference in New Issue
Block a user