Installation
npm install --save @types/jsend
Summary
This package contains type definitions for jsend (https://github.com/Prestaul/jsend).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsend.
index.d.ts
declare namespace Express {
export interface Response {
jsend: jsend.jsendExpress;
}
}
declare namespace jsend {
interface JSendObject {
status: string;
code?: number | undefined;
data?: any;
message?: string | undefined;
}
interface jsendCore {
success(data: Object): JSendObject;
fail(data: Object): JSendObject;
error(message: string | { message: string; code?: number | undefined; data?: Object | undefined }): JSendObject;
}
interface jsendExpress extends jsendCore {
(err: string | Object, json?: Object): void;
}
interface jsend extends jsendCore {
isValid(json: Object): boolean;
forward(json: Object, done: (err: any, data: any) => any): void;
fromArguments(err: string | Object, json?: Object): JSendObject;
middleware(req: any, res: any, next: Function): any;
}
interface jsendExport extends jsend {
(config?: { strict: boolean }, host?: Object): jsend;
}
var jsend: jsendExport;
}
declare module "jsend" {
export = jsend.jsend;
}
Additional Details
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: none
Credits
These definitions were written by Federico Caselli.