Skip to content

Commit

Permalink
remove generics from HttpClient tag service (#4169)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Dec 22, 2024
1 parent cc9c8c0 commit 8250215
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 172 deletions.
8 changes: 8 additions & 0 deletions .changeset/friendly-kiwis-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@effect/platform": minor
---

remove generics from HttpClient tag service

Instead you can now use `HttpClient.With<E, R>` to specify the error and
requirement types.
6 changes: 3 additions & 3 deletions packages/platform/dtslint/HttpApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Effect.gen(function*() {
const clientEndpointEffect = HttpApiClient.endpoint(TestApi, "Group1", "EndpointA")
// $ExpectType never
type _clientEndpointEffectError = Effect.Effect.Error<typeof clientEndpointEffect>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointASecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | HttpClient<HttpClientError, Scope>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointASecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | HttpClient
type _clientEndpointEffectContext = Effect.Effect.Context<typeof clientEndpointEffect>

const clientEndpoint = yield* clientEndpointEffect
Expand All @@ -100,7 +100,7 @@ Effect.gen(function*() {
const clientGroupEffect = HttpApiClient.group(TestApi, "Group1")
// $ExpectType never
type _clientGroupEffectError = Effect.Effect.Error<typeof clientGroupEffect>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointBErrorR" | "EndpointBSuccessR" | "EndpointASecurityErrorR" | "EndpointBSecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | HttpClient<HttpClientError, Scope>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointBErrorR" | "EndpointBSuccessR" | "EndpointASecurityErrorR" | "EndpointBSecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | HttpClient
type _clientGroupEffectContext = Effect.Effect.Context<typeof clientGroupEffect>

const clientGroup = yield* clientGroupEffect
Expand All @@ -117,7 +117,7 @@ Effect.gen(function*() {
const clientApiEffect = HttpApiClient.make(TestApi)
// $ExpectType never
type _clientApiEffectError = Effect.Effect.Error<typeof clientApiEffect>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointBErrorR" | "EndpointBSuccessR" | "EndpointASecurityErrorR" | "EndpointBSecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | "Group2ErrorR" | "EndpointCErrorR" | "EndpointCSuccessR" | HttpClient<HttpClientError, Scope>
// $ExpectType "ApiErrorR" | "Group1ErrorR" | "EndpointAErrorR" | "EndpointASuccessR" | "EndpointBErrorR" | "EndpointBSuccessR" | "EndpointASecurityErrorR" | "EndpointBSecurityErrorR" | "Group1SecurityErrorR" | "ApiSecurityErrorR" | "Group2ErrorR" | "EndpointCErrorR" | "EndpointCSuccessR" | HttpClient
type _clientApiEffectContext = Effect.Effect.Context<typeof clientApiEffect>

const clientApi = yield* clientApiEffect
Expand Down
Loading

0 comments on commit 8250215

Please sign in to comment.