Skip to content

Commit 2decb27

Browse files
authored
🤖 Merge PR DefinitelyTyped#72511 [qs] Add the new throwOnLimitExceeded option to the parsers options definition by @BGehrels
1 parent bee369d commit 2decb27

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

‎types/qs/index.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ declare namespace QueryString {
5858
allowEmptyArrays?: boolean | undefined;
5959
duplicates?: "combine" | "first" | "last" | undefined;
6060
strictDepth?: boolean | undefined;
61+
throwOnLimitExceeded?: boolean | undefined;
6162
}
6263

6364
type IParseDynamicOptions<AllowDots extends BooleanOptional> = AllowDots extends true

‎types/qs/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/qs",
4-
"version": "6.9.9999",
4+
"version": "6.14.9999",
55
"projects": [
66
"https://github.com/ljharb/qs"
77
],

‎types/qs/qs-tests.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,17 @@ qs.parse("a=b&c=d", { delimiter: "&" });
411411
}
412412
});
413413

414+
(() => {
415+
assert.deepEqual(qs.parse('a=1&b=2&c=3', { parameterLimit: 5, throwOnLimitExceeded: true }), { a: '1', b: '2', c: '3' });
416+
});
417+
418+
(() => {
419+
assert.throws(
420+
() => qs.parse('a=1&b=2&c=3', { parameterLimit: 2, throwOnLimitExceeded: true }),
421+
RangeError
422+
);
423+
});
424+
414425
declare const myQuery: { a: string; b?: string | undefined };
415426
const myQueryCopy: qs.ParsedQs = myQuery;
416427

0 commit comments

Comments
 (0)