Added typings for "restify-cookies". (#20489)

* Added typings for "require-dir".

* Fixed dtslint errors.

* Fixed By field.

* Added typings for "restify-cookies".
This commit is contained in:
Viktor Isaev
2017-10-11 15:45:34 -07:00
committed by Wesley Wigham
parent 6fa7178e81
commit fad8178fc8
4 changed files with 54 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for restify-cookies 0.2
// Project: https://github.com/nathschmidt/restify-cookies
// Definitions by: weekens <https://github.com/weekens>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as restify from 'restify';
declare module 'restify' {
interface CookieOptions {
encode?: (input: string) => string; // tslint:disable-line:prefer-method-signature
maxAge?: number;
domain?: string;
path?: string;
expires?: string;
httpOnly?: boolean;
secure?: boolean;
}
interface Response {
setCookie(key: string, val: string, options?: CookieOptions): void;
}
}
@@ -0,0 +1,8 @@
import { Request, Response, Server } from 'restify';
import 'restify-cookies';
function test(server: Server) {
server.get('/api/test', (req: Request, res: Response) => {
res.setCookie('myCookie', 'test', { path: '/' });
});
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"restify-cookies-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }