From 446099f04a9e37009f4efa7a47da91c7787dd296 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 14 Sep 2015 15:10:27 +0300 Subject: [PATCH] qs definitions --- qs/qs-tests.ts | 9 +++++++++ qs/qs.d.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 qs/qs-tests.ts create mode 100644 qs/qs.d.ts diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts new file mode 100644 index 0000000000..04be4f266b --- /dev/null +++ b/qs/qs-tests.ts @@ -0,0 +1,9 @@ +/// + +import qs = require('qs'); + +qs.stringify({ a: 'b' }); +qs.stringify({ a: 'b', c: 'd' }, { delimiter: '&' }); + +qs.parse('a=b'); +qs.parse('a=b&c=d', { delimiter: '&' }); diff --git a/qs/qs.d.ts b/qs/qs.d.ts new file mode 100644 index 0000000000..eea44a749c --- /dev/null +++ b/qs/qs.d.ts @@ -0,0 +1,35 @@ +// Type definitions for qs +// Project: https://github.com/hapijs/qs +// Definitions by: Roman Korneev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module QueryString { + interface IStringifyOptions { + delimiter?: string; + strictNullHandling?: boolean; + skipNulls?: boolean; + encode?: boolean; + filter?: any; + arrayFormat?: any; + indices?: string; + } + + interface IParseOptions { + delimiter?: string; + depth?: number; + arrayLimit?: number; + parseArrays?: boolean; + allowDots?: boolean; + plainObjects?: boolean; + allowPrototypes?: boolean; + parameterLimit?: number; + strictNullHandling?: boolean; + } + + export function stringify(obj: any, options?: IStringifyOptions): string; + export function parse(str: string, options?: IParseOptions): any; +} + +declare module "qs" { + export = QueryString; +}