UNPKG

1.04 kBTypeScriptView Raw
1// Type definitions for cookie-parser 1.4
2// Project: https://github.com/expressjs/cookie-parser
3// Definitions by: Santi Albo <https://github.com/santialbo>
4// BendingBender <https://github.com/BendingBender>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.3
7
8import * as express from 'express';
9
10declare function cookieParser(secret?: string | string[], options?: cookieParser.CookieParseOptions): express.RequestHandler;
11
12declare namespace cookieParser {
13 interface CookieParseOptions {
14 decode?(val: string): string;
15 }
16
17 function JSONCookie(jsonCookie: string): object | undefined;
18
19 function JSONCookies<T extends { [key: string]: string }>(jsonCookies: T): { [P in keyof T]: object | undefined };
20
21 function signedCookie(cookie: string, secret: string | string[]): string | false;
22
23 function signedCookies<T extends { [key: string]: string }>(cookies: T, secret: string | string[]): { [P in keyof T]?: string | false};
24}
25
26export = cookieParser;