Skip to content

[Feature Request] Support undefined or null value in searchParams? #293

@Connect-a

Description

@Connect-a

I think there are cases where you want to pass undefined or null to the searchParams.

type Foo = {
  a: string;
  b?: number;
};

const foo: Foo = { a: 'a' };

ky.get('https://example.com', { searchParams: foo }); 
// ↑ TS2322: Type 'undefined' is not assignable to type 'string | number | boolean'.

Is it possible to accept undefined / null values and ignore them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions