Skip to content

Commit

Permalink
fix: fix QueryValue type to be array only as QueryObject values (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Nov 24, 2022
1 parent f8bf741 commit 3fbad8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
encodeQueryValue
} from "./encoding";

export type QueryValue = string | string[] | undefined | null
export type QueryObject = Record<string, QueryValue>
export type QueryValue = string | undefined | null
export type QueryObject = Record<string, QueryValue | QueryValue[]>

export function parseQuery (parametersString: string = ""): QueryObject {
const object: QueryObject = {};
Expand Down Expand Up @@ -34,7 +34,7 @@ export function parseQuery (parametersString: string = ""): QueryObject {
return object;
}

export function encodeQueryItem (key: string, value: QueryValue): string {
export function encodeQueryItem (key: string, value: QueryValue | QueryValue[]): string {
if (typeof value === "number" || typeof value === "boolean") {
value = String(value);
}
Expand Down

0 comments on commit 3fbad8c

Please sign in to comment.