diff --git a/packages/reffuse/src/ReffuseNamespace.ts b/packages/reffuse/src/ReffuseNamespace.ts index 66b3400..d768eb5 100644 --- a/packages/reffuse/src/ReffuseNamespace.ts +++ b/packages/reffuse/src/ReffuseNamespace.ts @@ -30,7 +30,7 @@ export abstract class ReffuseNamespace { this.SubRef = this.SubRef.bind(this as any) as any this.SubscribeRefs = this.SubscribeRefs.bind(this as any) as any this.RefState = this.RefState.bind(this as any) as any - // this.SubscribeStream = this.SubscribeStream.bind(this as any) as any + this.SubscribeStream = this.SubscribeStream.bind(this as any) as any } @@ -592,16 +592,31 @@ export abstract class ReffuseNamespace { return props.children(this.useRefState(props.ref)) } - // SubscribeStream( - // this: ReffuseNamespace, - // props: { - // readonly stream: Stream.Stream - // readonly initialValue?: () => Effect.Effect - // readonly children: (latestValue: InitialA extends A ? Option.Some : Option.Option) => React.ReactNode - // }, - // ): React.ReactNode { - // return props.children(this.useSubscribeStream(props.stream, props.initialValue)) - // } + SubscribeStream( + this: ReffuseNamespace, + props: { + readonly stream: Stream.Stream + readonly children: (latestValue: Option.Option) => React.ReactNode + }, + ): React.ReactNode + SubscribeStream( + this: ReffuseNamespace, + props: { + readonly stream: Stream.Stream + readonly initialValue: () => Effect.Effect + readonly children: (latestValue: Option.Some) => React.ReactNode + }, + ): React.ReactNode + SubscribeStream( + this: ReffuseNamespace, + props: { + readonly stream: Stream.Stream + readonly initialValue?: () => Effect.Effect + readonly children: (latestValue: Option.Some) => React.ReactNode + }, + ): React.ReactNode { + return props.children(this.useSubscribeStream(props.stream, props.initialValue as () => Effect.Effect)) + } }