Skip to content

Commit

Permalink
fixed search params related function signatures (#3339)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubhy authored Jul 25, 2024
1 parent 1c4176c commit eb4d014
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-shirts-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/platform": patch
---

Fixed various search params related function signatures (`Array => ReadonlyArray`)
6 changes: 3 additions & 3 deletions packages/platform/src/HttpRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export const schemaJson: <
readonly cookies: Readonly<Record<string, string | undefined>>
readonly headers: Readonly<Record<string, string | undefined>>
readonly pathParams: Readonly<Record<string, string | undefined>>
readonly searchParams: Readonly<Record<string, string | Array<string> | undefined>>
readonly searchParams: Readonly<Record<string, string | ReadonlyArray<string> | undefined>>
readonly body: any
}>,
A
Expand All @@ -276,7 +276,7 @@ export const schemaNoBody: <
readonly cookies: Readonly<Record<string, string | undefined>>
readonly headers: Readonly<Record<string, string | undefined>>
readonly pathParams: Readonly<Record<string, string | undefined>>
readonly searchParams: Readonly<Record<string, string | Array<string> | undefined>>
readonly searchParams: Readonly<Record<string, string | ReadonlyArray<string> | undefined>>
}
>,
A
Expand All @@ -293,7 +293,7 @@ export const schemaNoBody: <
* @since 1.0.0
* @category route context
*/
export const schemaParams: <A, I extends Readonly<Record<string, string | Array<string> | undefined>>, R>(
export const schemaParams: <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => Effect.Effect<A, ParseResult.ParseError, R | RouteContext | ServerRequest.ParsedSearchParams> =
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/HttpServerRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const schemaHeaders: <A, I extends Readonly<Record<string, string | undef
* @since 1.0.0
* @category schema
*/
export const schemaSearchParams: <A, I extends Readonly<Record<string, string | Array<string> | undefined>>, R>(
export const schemaSearchParams: <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => Effect.Effect<A, ParseResult.ParseError, ParsedSearchParams | R> = internal.schemaSearchParams
Expand Down
6 changes: 3 additions & 3 deletions packages/platform/src/internal/httpRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const schemaJson = <
readonly cookies: Readonly<Record<string, string | undefined>>
readonly headers: Readonly<Record<string, string | undefined>>
readonly pathParams: Readonly<Record<string, string | undefined>>
readonly searchParams: Readonly<Record<string, string | Array<string> | undefined>>
readonly searchParams: Readonly<Record<string, string | ReadonlyArray<string> | undefined>>
readonly body: any
}>,
A
Expand Down Expand Up @@ -88,7 +88,7 @@ export const schemaNoBody = <
readonly cookies: Readonly<Record<string, string | undefined>>
readonly headers: Readonly<Record<string, string | undefined>>
readonly pathParams: Readonly<Record<string, string | undefined>>
readonly searchParams: Readonly<Record<string, string | Array<string> | undefined>>
readonly searchParams: Readonly<Record<string, string | ReadonlyArray<string> | undefined>>
}>,
A
>(
Expand All @@ -115,7 +115,7 @@ export const schemaNoBody = <
}

/** @internal */
export const schemaParams = <A, I extends Readonly<Record<string, string | Array<string> | undefined>>, R>(
export const schemaParams = <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => {
Expand Down
6 changes: 5 additions & 1 deletion packages/platform/src/internal/httpServerRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const schemaHeaders = <A, I extends Readonly<Record<string, string | unde
}

/** @internal */
export const schemaSearchParams = <A, I extends Readonly<Record<string, string | Array<string> | undefined>>, R>(
export const schemaSearchParams = <
A,
I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>,
R
>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => {
Expand Down

0 comments on commit eb4d014

Please sign in to comment.