Skip to content

Commit 56d2923

Browse files
committedSep 13, 2020
Fix the ParsedQuery TypeScript typ
Fixes #273
1 parent f38dab5 commit 56d2923

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export interface ParseOptions {
121121
```
122122
*/
123123
readonly parseBooleans?: boolean;
124-
124+
125125
/**
126126
Parse the fragment identifier from the URL and add it to result object.
127127
@@ -139,7 +139,7 @@ export interface ParseOptions {
139139
}
140140

141141
export interface ParsedQuery<T = string> {
142-
[key: string]: T | T[] | null | undefined;
142+
[key: string]: T | T[] | null;
143143
}
144144

145145
/**

4 commit comments

Comments
 (4)

krtrice commented on Sep 24, 2020

@krtrice

@sindresorhus In your readme file, undefined is described as the means of removing a param from a URL. Since this is a breaking change that no longer supports this use case for typescript users, I would suggest removing references to undefined from your docs.

sindresorhus commented on Sep 24, 2020

@sindresorhus
OwnerAuthor

This change is about the return value for parsing, not stringifying.

krtrice commented on Sep 24, 2020

@krtrice

Reviewing https://github.com/sindresorhus/query-string/blob/master/index.d.ts, the ParsedQuery interface is being used in the stringifyUrl() parameter types in addition to the parse() return types.

// line 141
export interface ParsedQuery<T = string> {
	[key: string]: T | T[] | null;
}

// line 157
export interface ParsedUrl {
	readonly url: string;
	readonly query: ParsedQuery;

	/**
	The fragment identifier of the URL.
	Present when the `parseFragmentIdentifier` option is `true`.
	*/
	readonly fragmentIdentifier?: string;
}

// line 382
export function stringifyUrl(
	object: ParsedUrl,
	options?: StringifyOptions
): string;
Please sign in to comment.