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

Typings for stringifyUrl don't allow empty query #308

Closed
IlyaSemenov opened this issue Feb 23, 2021 · 0 comments
Closed

Typings for stringifyUrl don't allow empty query #308

IlyaSemenov opened this issue Feb 23, 2021 · 0 comments

Comments

@IlyaSemenov
Copy link

This is a valid code:

> require('query-string').stringifyUrl({url:'/some'})
'/some'

Yet it emits a TS error:

Argument of type '{ url: string; }' is not assignable to parameter of type 'UrlObject'.
  Property 'query' is missing in type '{ url: string; }' but required in type 'UrlObject'.ts(2345)

I believe query must be marked as query? here:

query-string/index.d.ts

Lines 369 to 375 in 2a17881

export interface UrlObject {
readonly url: string;
/**
Overrides queries in the `url` property.
*/
readonly query: StringifiableRecord;

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

No branches or pull requests

1 participant