1.0.9 • Published 6 months ago

@types/express-flash-2 v1.0.9

Weekly downloads
15
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/express-flash-2

Summary

This package contains type definitions for express-flash-2 (https://github.com/jack2gs/express-flash-2).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-flash-2.

index.d.ts

// Type definitions for express-flash-2 1.0
// Project: https://github.com/jack2gs/express-flash-2
// Definitions by: Matheus Salmi <https://github.com/mathsalmi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import express = require('express');

/**
 * Expose `flash()` function on responses.
 */
declare function flash(): express.RequestHandler;

export = flash;

declare global {
    namespace Express {
        interface Request {
            session?: Session | undefined;
        }

        interface Session {
            flash: Flash;
        }

        interface Flash {
            [key: string]: any[];
        }

        interface Response {
            /**
             * Queue flash `msg` of the given `type`.
             *
             * Examples:
             *
             *      req.flash('info', 'email sent');
             *      req.flash('error', 'email delivery failed');
             *      req.flash('info', 'email re-sent');
             *
             *
             * Formatting:
             *
             * Flash notifications also support arbitrary formatting support.
             * For example you may pass variable arguments to `req.flash()`
             * and use the %s specifier to be replaced by the associated argument:
             *
             *     req.flash('info', 'email has been sent to %s.', userName);
             *
             * Formatting uses `util.format()`, which is available on Node 0.6+.
             */
            flash(type: string, msg: string | any[]): void;

            locals: {
                flash?: Flash | undefined
            };
        }
    }
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 12:01:18 GMT
  • Dependencies: @types/express
  • Global values: none

Credits

These definitions were written by Matheus Salmi.

1.0.9

6 months ago

1.0.8

7 months ago

1.0.7

8 months ago

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago