@types/jsend
TypeScript icon, indicating that this package has built-in type declarations

1.0.32 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/jsend

Weekly Downloads

1,814

Version

1.0.32

License

MIT

Unpacked Size

4.74 kB

Total Files

5

Last publish

Collaborators

  • types