From b15f945fc11ef46d34ba703856f5560112d310ea Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 27 Sep 2020 15:05:07 +0200 Subject: [PATCH 1/2] Fix the TypeScript type for the `.stringifyUrl()` method --- index.d.ts | 16 +++++++++++++++- index.test-d.ts | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 343a68ec..ab1e5d8c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -354,6 +354,20 @@ Note: This behaviour can be changed with the `skipNull` option. */ export function extract(url: string): string; +export interface UrlObject { + readonly url: string; + + /** + Qverrides queries in the `url` property. + */ + readonly query: Record; + + /** + Overrides the fragment identifier in the `url` property. + */ + readonly fragmentIdentifier?: string; +} + /** Stringify an object into a URL with a query string and sorting the keys. The inverse of [`.parseUrl()`](https://github.com/sindresorhus/query-string#parseurlstring-options) @@ -380,6 +394,6 @@ queryString.stringifyUrl({ ``` */ export function stringifyUrl( - object: ParsedUrl, + object: UrlObject, options?: StringifyOptions ): string; diff --git a/index.test-d.ts b/index.test-d.ts index a7563e8a..72156b96 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -93,3 +93,5 @@ expectType( // Extract expectType(queryString.extract('http://foo.bar/?abc=def&hij=klm')); + +expectType(queryString.stringifyUrl({url: 'https://sindresorhus.com', query: {foo: undefined}})); From eb769d201ddc6dc0afd82b1a2f53132a655e6005 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 27 Sep 2020 15:06:05 +0200 Subject: [PATCH 2/2] 6.13.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e07c53bd..473be3e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "query-string", - "version": "6.13.2", + "version": "6.13.3", "description": "Parse and stringify URL query strings", "license": "MIT", "repository": "sindresorhus/query-string",