Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix searchParams option TypeScript type #344

Merged
merged 2 commits into from
May 14, 2021

Conversation

mgcrea
Copy link
Contributor

@mgcrea mgcrea commented May 13, 2021

I narrowed the type to fix a TypeScript error when the option was passed to the URLSearchParams constructor, but obviously it was a mistake as we don't want any breaking changes. We might want to reconsider in the future to be more compliant with the official types.

I've added a manual as to the constructor as a fix.


Fixes #343

@@ -2,6 +2,8 @@ import type {LiteralUnion, Required} from './common.js';
import type {Hooks} from './hooks.js';
import type {RetryOptions} from './retry.js';

export type SearchParamsInit = string | string[][] | Record<string, string> | URLSearchParams | undefined;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this type already available in the DOM lib?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source/types/options.ts Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title fix(typings): revert searchParams strict typing (closes #343) Fix searchParams option TypeScript type May 14, 2021
@sindresorhus sindresorhus merged commit 010b082 into sindresorhus:main May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discrepancy between doc and types for searchparams options in v 0.28
2 participants