@@ -13,25 +13,25 @@ export interface ParseOptions {
1313 *
1414 *
1515 * queryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'});
16- * //=> foo: [1, 2, 3 ]
16+ * //=> foo: ['1', '2', '3' ]
1717 *
1818 * - `index`: Parse arrays with index representation:
1919 *
2020 *
2121 * queryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'});
22- * //=> foo: [1, 2, 3 ]
22+ * //=> foo: ['1', '2', '3' ]
2323 *
2424 * - `comma`: Parse arrays with elements separated by comma:
2525 *
2626 *
2727 * queryString.parse('foo=1,2,3', {arrayFormat: 'comma'});
28- * //=> foo: [1, 2, 3 ]
28+ * //=> foo: ['1', '2', '3' ]
2929 *
3030 * - `none`: Parse arrays with elements using duplicate keys:
3131 *
3232 *
3333 * queryString.parse('foo=1&foo=2&foo=3');
34- * //=> foo: [1, 2, 3 ]
34+ * //=> foo: ['1', '2', '3' ]
3535 */
3636 readonly arrayFormat ?: 'bracket' | 'index' | 'comma' | 'none' ;
3737
@@ -55,10 +55,21 @@ export interface ParseOptions {
5555 */
5656 readonly sort ?: ( ( itemLeft : string , itemRight : string ) => number ) | false ;
5757
58+ /**
59+ * Parse the value as a number type instead of string type if it's a number.
60+ *
61+ * @default false
62+ *
63+ * @example
64+ *
65+ * queryString.parse('foo[]=1&foo[]=2&foo[]=3', {parseNumbers: true});
66+ * //=> foo: [1, 2, 3]
67+ */
68+ readonly parseNumbers ?: boolean ;
5869}
5970
6071export interface ParsedQuery {
61- readonly [ key : string ] : string | string [ ] | null | undefined ;
72+ readonly [ key : string ] : string | number | Array < string | number > | null | undefined ;
6273}
6374
6475/**
0 commit comments