From ab441fe9827d01a4e394b1fc17a48808494207ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 21 Apr 2025 02:01:24 +0200 Subject: [PATCH] Fix --- .../reffuse/src/types/SubscriptionSubRef.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/reffuse/src/types/SubscriptionSubRef.ts b/packages/reffuse/src/types/SubscriptionSubRef.ts index 151f515..cb7622e 100644 --- a/packages/reffuse/src/types/SubscriptionSubRef.ts +++ b/packages/reffuse/src/types/SubscriptionSubRef.ts @@ -1,21 +1,34 @@ -import { Effect, Effectable, Readable, Ref, Stream, Subscribable, SubscriptionRef, SynchronizedRef } from "effect" +import { Effect, Effectable, Readable, Ref, Stream, Subscribable, SubscriptionRef, SynchronizedRef, type Types } from "effect" -export interface SubscriptionSubRef extends SubscriptionRef.SubscriptionRef { +export const SubscriptionSubRefTypeId: unique symbol = Symbol.for("reffuse/types/SubscriptionSubRef") + +export interface SubscriptionSubRef extends SubscriptionSubRef.Variance, SubscriptionRef.SubscriptionRef { readonly parent: SubscriptionRef.SubscriptionRef } +export declare namespace SubscriptionSubRef { + export interface Variance { + readonly [SubscriptionSubRefTypeId]: { + readonly _A: Types.Invariant + readonly _B: Types.Invariant + } + } +} + const refVariance = { _A: (_: any) => _ } const synchronizedRefVariance = { _A: (_: any) => _ } const subscriptionRefVariance = { _A: (_: any) => _ } +const subscriptionSubRefVariance = { _A: (_: any) => _, _B: (_: any) => _ } class SubscriptionSubRefImpl extends Effectable.Class implements SubscriptionSubRef { readonly [Readable.TypeId]: Readable.TypeId = Readable.TypeId readonly [Subscribable.TypeId]: Subscribable.TypeId = Subscribable.TypeId - readonly [Ref.RefTypeId]: Ref.Ref.Variance[Ref.RefTypeId] = refVariance - readonly [SynchronizedRef.SynchronizedRefTypeId]: SynchronizedRef.SynchronizedRef.Variance[SynchronizedRef.SynchronizedRefTypeId] = synchronizedRefVariance - readonly [SubscriptionRef.SubscriptionRefTypeId]: SubscriptionRef.SubscriptionRef.Variance[SubscriptionRef.SubscriptionRefTypeId] = subscriptionRefVariance + readonly [Ref.RefTypeId] = refVariance + readonly [SynchronizedRef.SynchronizedRefTypeId] = synchronizedRefVariance + readonly [SubscriptionRef.SubscriptionRefTypeId] = subscriptionRefVariance + readonly [SubscriptionSubRefTypeId] = subscriptionSubRefVariance readonly get: Effect.Effect