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