diff --git a/types/cookie/cookie-tests.ts b/types/cookie/cookie-tests.ts index dd5be0f850..08e4d43519 100644 --- a/types/cookie/cookie-tests.ts +++ b/types/cookie/cookie-tests.ts @@ -1,23 +1,21 @@ - - import cookie = require('cookie'); function test_serialize(): void { - var retVal: string; + let retVal: string; retVal = cookie.serialize('foo', 'bar'); retVal = cookie.serialize('foo', 'bar', { httpOnly: true }); } function test_parse(): void { - var retVal: { [key: string]: string }; + let retVal: { [key: string]: string }; retVal = cookie.parse('foo=bar; bar=baz;'); retVal = cookie.parse('foo=bar; bar=baz', { decode: x => x }); } function test_options(): void { - var serializeOptions: cookie.CookieSerializeOptions = { + const serializeOptions: cookie.CookieSerializeOptions = { encode: (x: string) => x, path: '/', expires: new Date(), @@ -27,7 +25,7 @@ function test_options(): void { httpOnly: false }; - var parseOptios: cookie.CookieParseOptions = { + const parseOptios: cookie.CookieParseOptions = { decode: (x: string) => x }; } diff --git a/types/cookie/index.d.ts b/types/cookie/index.d.ts index 507eaee01d..bb7fc2cb54 100644 --- a/types/cookie/index.d.ts +++ b/types/cookie/index.d.ts @@ -1,15 +1,16 @@ -// Type definitions for cookie v0.3.0 +// Type definitions for cookie 0.3 // Project: https://github.com/jshttp/cookie // Definitions by: Pine Mizune // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface CookieSerializeOptions { +export interface CookieSerializeOptions { /** * Specifies the value for the Domain Set-Cookie attribute. By default, no * domain is set, and most clients will consider the cookie to apply to only * the current domain. */ domain?: string; + /** * Specifies a function that will be used to encode a cookie's value. Since * value of a cookie has a limited character set (and must be a simple @@ -20,7 +21,8 @@ interface CookieSerializeOptions { * encode a JavaScript string into UTF-8 byte sequences and then URL-encode * any that fall outside of the cookie range. */ - encode?: (val: string) => string; + encode?(val: string): string; + /** * Specifies the `Date` object to be the value for the `Expires` * `Set-Cookie` attribute. By default, no expiration is set, and most @@ -83,7 +85,7 @@ interface CookieSerializeOptions { secure?: boolean; } -interface CookieParseOptions { +export interface CookieParseOptions { /** * Specifies a function that will be used to decode a cookie's value. Since * the value of a cookie has a limited character set (and must be a simple @@ -96,7 +98,7 @@ interface CookieParseOptions { * *Note* if an error is thrown from this function, the original, non-decoded * cookie value will be returned as the cookie's value. */ - decode?: (val: string) => string; + decode?(val: string): string; } /** diff --git a/types/cookie/tslint.json b/types/cookie/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cookie/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }