Skip to content

Commit

Permalink
Allow null and undefined in Stringifiable TypeScript type (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
esetnik committed Oct 2, 2020
1 parent 231c160 commit df4cbb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Expand Up @@ -339,11 +339,11 @@ export interface StringifyOptions {
readonly skipEmptyString?: boolean;
}

export type Stringifiable = string | boolean | number;
export type Stringifiable = string | boolean | number | null | undefined;

export type StringifiableRecord = Record<
string,
Stringifiable | Stringifiable[] | null | undefined
Stringifiable | Stringifiable[]
>;

/**
Expand Down
7 changes: 5 additions & 2 deletions index.test-d.ts
Expand Up @@ -98,9 +98,12 @@ expectType<string>(
queryString.stringifyUrl({
url: 'https://sindresorhus.com',
query: {
fooArray: [
fooMixedArray: [
'a',
'b'
1,
true,
null,
undefined
],
fooNumber: 1,
fooBoolean: true,
Expand Down

0 comments on commit df4cbb3

Please sign in to comment.