From d00bce875c5626443a341b0d5428f86b1889779d Mon Sep 17 00:00:00 2001 From: miyaji255 <84168445+miyaji255@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:20:40 +0900 Subject: [PATCH] replace URLSearchParams to IReadableURLSearchParams --- src/IReadableURLSearchParams.ts | 4 +++ .../metadata/iterate_metadata_constant.ts | 2 +- src/http.ts | 31 ++++++++++++------- 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/IReadableURLSearchParams.ts diff --git a/src/IReadableURLSearchParams.ts b/src/IReadableURLSearchParams.ts new file mode 100644 index 0000000000..dd9106cd3f --- /dev/null +++ b/src/IReadableURLSearchParams.ts @@ -0,0 +1,4 @@ +/** + * Interface for a readable URLSearchParams object + */ +export type IReadableURLSearchParams = Pick; diff --git a/src/factories/internal/metadata/iterate_metadata_constant.ts b/src/factories/internal/metadata/iterate_metadata_constant.ts index cfb3a1cb76..33f404fe62 100644 --- a/src/factories/internal/metadata/iterate_metadata_constant.ts +++ b/src/factories/internal/metadata/iterate_metadata_constant.ts @@ -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, }; }; diff --git a/src/http.ts b/src/http.ts index 007930b955..7b8a4eeef7 100644 --- a/src/http.ts +++ b/src/http.ts @@ -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"; @@ -238,7 +239,9 @@ export { validateFormDataPure as validateFormData }; * * @author Jeongho Nam - https://github.com/samchon */ -function query(input: string | URLSearchParams): Resolved; +function query( + input: string | IReadableURLSearchParams, +): Resolved; /** * @internal @@ -282,7 +285,7 @@ export { queryPure as query }; * @author Jeongho Nam - https://github.com/samchon */ function assertQuery( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): Resolved; @@ -331,7 +334,7 @@ export { assertQueryPure as assertQuery }; * @author Jeongho Nam - https://github.com/samchon */ function isQuery( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ): Resolved | null; /** @@ -377,7 +380,7 @@ export { isQueryPure as isQuery }; * @author Jeongho Nam - https://github.com/samchon */ function validateQuery( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ): IValidation>; /** @@ -901,13 +904,13 @@ function createQuery(): never; * @author Jeongho Nam - https://github.com/samchon */ function createQuery(): ( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ) => T; /** * @internal */ -function createQuery(): (input: string | URLSearchParams) => T { +function createQuery(): (input: string | IReadableURLSearchParams) => T { halt("createQuery"); } @@ -942,12 +945,14 @@ function createAssertQuery( */ function createAssertQuery( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), -): (input: string | URLSearchParams) => T; +): (input: string | IReadableURLSearchParams) => T; /** * @internal */ -function createAssertQuery(): (input: string | URLSearchParams) => T { +function createAssertQuery(): ( + input: string | IReadableURLSearchParams, +) => T { halt("createAssertQuery"); } @@ -982,13 +987,15 @@ function createIsQuery(): never; * @author Jeongho Nam - https://github.com/samchon */ function createIsQuery(): ( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ) => T | null; /** * @internal */ -function createIsQuery(): (input: string | URLSearchParams) => T | null { +function createIsQuery(): ( + input: string | IReadableURLSearchParams, +) => T | null { halt("createIsQuery"); } @@ -1023,14 +1030,14 @@ function createValidateQuery(): never; * @author Jeongho Nam - https://github.com/samchon */ function createValidateQuery(): ( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ) => IValidation>; /** * @internal */ function createValidateQuery(): ( - input: string | URLSearchParams, + input: string | IReadableURLSearchParams, ) => IValidation> { halt("createValidateQuery"); }