Skip to content

Commit

Permalink
replace URLSearchParams to IReadableURLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Nov 6, 2024
1 parent 8a93cd7 commit d00bce8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions src/IReadableURLSearchParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Interface for a readable URLSearchParams object
*/
export type IReadableURLSearchParams = Pick<URLSearchParams, "get" | "getAll">;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const iterate_metadata_constant =
return {
jsDocTags: type.symbol?.getJsDocTags(),
description: type.symbol
? CommentFactory.description(type.symbol) ?? null
? (CommentFactory.description(type.symbol) ?? null)
: undefined,
};
};
Expand Down
31 changes: 19 additions & 12 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as Namespace from "./functional/Namespace";

import { Atomic } from "./typings/Atomic";

import type { IReadableURLSearchParams } from "./IReadableURLSearchParams";
import { IValidation } from "./IValidation";
import { Resolved } from "./Resolved";
import { TypeGuardError } from "./TypeGuardError";
Expand Down Expand Up @@ -238,7 +239,9 @@ export { validateFormDataPure as validateFormData };
*
* @author Jeongho Nam - https://github.com/samchon
*/
function query<T extends object>(input: string | URLSearchParams): Resolved<T>;
function query<T extends object>(
input: string | IReadableURLSearchParams,
): Resolved<T>;

/**
* @internal
Expand Down Expand Up @@ -282,7 +285,7 @@ export { queryPure as query };
* @author Jeongho Nam - https://github.com/samchon
*/
function assertQuery<T extends object>(
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
): Resolved<T>;

Expand Down Expand Up @@ -331,7 +334,7 @@ export { assertQueryPure as assertQuery };
* @author Jeongho Nam - https://github.com/samchon
*/
function isQuery<T extends object>(
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
): Resolved<T> | null;

/**
Expand Down Expand Up @@ -377,7 +380,7 @@ export { isQueryPure as isQuery };
* @author Jeongho Nam - https://github.com/samchon
*/
function validateQuery<T extends object>(
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
): IValidation<Resolved<T>>;

/**
Expand Down Expand Up @@ -901,13 +904,13 @@ function createQuery(): never;
* @author Jeongho Nam - https://github.com/samchon
*/
function createQuery<T extends object>(): (
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
) => T;

/**
* @internal
*/
function createQuery<T>(): (input: string | URLSearchParams) => T {
function createQuery<T>(): (input: string | IReadableURLSearchParams) => T {
halt("createQuery");
}

Expand Down Expand Up @@ -942,12 +945,14 @@ function createAssertQuery(
*/
function createAssertQuery<T extends object>(
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
): (input: string | URLSearchParams) => T;
): (input: string | IReadableURLSearchParams) => T;

/**
* @internal
*/
function createAssertQuery<T>(): (input: string | URLSearchParams) => T {
function createAssertQuery<T>(): (
input: string | IReadableURLSearchParams,
) => T {
halt("createAssertQuery");
}

Expand Down Expand Up @@ -982,13 +987,15 @@ function createIsQuery(): never;
* @author Jeongho Nam - https://github.com/samchon
*/
function createIsQuery<T extends object>(): (
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
) => T | null;

/**
* @internal
*/
function createIsQuery<T>(): (input: string | URLSearchParams) => T | null {
function createIsQuery<T>(): (
input: string | IReadableURLSearchParams,
) => T | null {
halt("createIsQuery");
}

Expand Down Expand Up @@ -1023,14 +1030,14 @@ function createValidateQuery(): never;
* @author Jeongho Nam - https://github.com/samchon
*/
function createValidateQuery<T extends object>(): (
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
) => IValidation<Resolved<T>>;

/**
* @internal
*/
function createValidateQuery<T>(): (
input: string | URLSearchParams,
input: string | IReadableURLSearchParams,
) => IValidation<Resolved<T>> {
halt("createValidateQuery");
}
Expand Down

0 comments on commit d00bce8

Please sign in to comment.