Skip to content

Commit

Permalink
revert RcRef Unify change (#3693)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Sep 27, 2024
1 parent 59f7965 commit ae69407
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changeset/fast-experts-melt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"effect": patch
---

fix Unify for RcRef & Deferred
fix Unify for Deferred
4 changes: 2 additions & 2 deletions packages/effect/dtslint/Unify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export type SubscriptionRefUnify = Unify.Unify<
| SubscriptionRef.SubscriptionRef<1>
| SubscriptionRef.SubscriptionRef<"a">
>
// $ExpectType RcRef<1, 2> | RcRef<"a", "b">
// $ExpectType RcRef<"a" | 1, "b" | 2>
export type RcRefUnify = Unify.Unify<
| RcRef.RcRef<1, 2>
| RcRef.RcRef<"a", "b">
Expand Down Expand Up @@ -138,7 +138,7 @@ export type ResourceUnify = Unify.Unify<
| Resource.Resource<any, any>
>

// $ExpectType 0 | Option<string | number> | Ref<1> | Ref<"a"> | SynchronizedRef<1> | SynchronizedRef<"a"> | SubscriptionRef<1> | SubscriptionRef<"a"> | RcRef<"a", "b"> | Deferred<"a", "b"> | FiberRef<1> | FiberRef<"a"> | ManagedRuntime<"a", "b"> | Queue<1> | Queue<"a"> | Dequeue<"a" | 1> | Pool<1, 2> | Pool<"a", "b" | "c"> | ScopedRef<1> | ScopedRef<"a"> | Resource<"a", "b"> | RcRef<1, 0> | Deferred<1, 0> | Resource<1, 0> | Latch | ManagedRuntime<1, 0> | Fiber<"a" | 1, 0 | "b"> | RuntimeFiber<"a" | 1, 0 | "b"> | Either<"a" | 1, 0 | "b"> | Effect<"a" | 1, 0 | "b", "R" | "R1">
// $ExpectType 0 | Option<string | number> | Ref<1> | Ref<"a"> | SynchronizedRef<1> | SynchronizedRef<"a"> | SubscriptionRef<1> | SubscriptionRef<"a"> | Deferred<"a", "b"> | FiberRef<1> | FiberRef<"a"> | ManagedRuntime<"a", "b"> | Queue<1> | Queue<"a"> | Dequeue<"a" | 1> | Pool<1, 2> | Pool<"a", "b" | "c"> | ScopedRef<1> | ScopedRef<"a"> | Resource<"a", "b"> | Deferred<1, 0> | Resource<1, 0> | Latch | ManagedRuntime<1, 0> | RcRef<"a" | 1, 0 | "b"> | Fiber<"a" | 1, 0 | "b"> | RuntimeFiber<"a" | 1, 0 | "b"> | Either<"a" | 1, 0 | "b"> | Effect<"a" | 1, 0 | "b", "R" | "R1">
export type AllUnify = Unify.Unify<
| Either.Either<1, 0>
| Either.Either<"a", "b">
Expand Down
3 changes: 2 additions & 1 deletion packages/effect/src/RcRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export interface RcRef<out A, out E = never>
* @since 3.8.0
*/
export interface RcRefUnify<A extends { [Unify.typeSymbol]?: any }> extends Effect.EffectUnify<A> {
RcRef?: () => Extract<A[Unify.typeSymbol], RcRef<any, any>>
RcRef?: () => A[Unify.typeSymbol] extends RcRef<infer A0, infer E0> | infer _ ? RcRef<A0, E0>
: never
}

/**
Expand Down

0 comments on commit ae69407

Please sign in to comment.