Skip to content

Commit

Permalink
default fn arg type to void
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Dec 6, 2023
1 parent a69d402 commit e4da41a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-knives-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect-rx/rx": patch
---

default fn arg type to void
8 changes: 4 additions & 4 deletions docs/rx/Rx.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ export declare const fn: {
<Arg, E, A>(
fn: Rx.ReadFn<Arg, Effect.Effect<Scope.Scope, E, A>>,
options?: { readonly initialValue?: A | undefined } | undefined
): RxResultFn<E, A, Arg>
): RxResultFn<E, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
<Arg, E, A>(
fn: Rx.ReadFn<Arg, Stream.Stream<never, E, A>>,
options?: { readonly initialValue?: A | undefined } | undefined
): RxResultFn<E | NoSuchElementException, A, Arg>
): RxResultFn<E | NoSuchElementException, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
}
```
Expand Down Expand Up @@ -607,13 +607,13 @@ export interface RxRuntime<ER, R> extends Rx<Result.Result<ER, Runtime.Runtime<R
options?: {
readonly initialValue?: A
}
): RxResultFn<E | ER, A, Arg>
): RxResultFn<E | ER, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
<Arg, E, A>(
fn: Rx.ReadFn<Arg, Stream.Stream<R, E, A>>,
options?: {
readonly initialValue?: A
}
): RxResultFn<E | ER | NoSuchElementException, A, Arg>
): RxResultFn<E | ER | NoSuchElementException, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
}

readonly pull: <E, A>(
Expand Down
13 changes: 7 additions & 6 deletions packages/rx/src/Rx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { type Pipeable, pipeArguments } from "effect/Pipeable"
import * as Runtime from "effect/Runtime"
import * as Scope from "effect/Scope"
import * as Stream from "effect/Stream"
import type * as Types from "effect/Types"
import * as internalRegistry from "./internal/registry.js"
import { runCallbackSync } from "./internal/runtime.js"
import * as Result from "./Result.js"
Expand Down Expand Up @@ -483,10 +484,10 @@ export interface RxRuntime<ER, R> extends Rx<Result.Result<ER, Runtime.Runtime<R
readonly fn: {
<Arg, E, A>(fn: Rx.ReadFn<Arg, Effect.Effect<Scope.Scope | R, E, A>>, options?: {
readonly initialValue?: A
}): RxResultFn<E | ER, A, Arg>
}): RxResultFn<E | ER, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
<Arg, E, A>(fn: Rx.ReadFn<Arg, Stream.Stream<R, E, A>>, options?: {
readonly initialValue?: A
}): RxResultFn<E | ER | NoSuchElementException, A, Arg>
}): RxResultFn<E | ER | NoSuchElementException, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
}

readonly pull: <E, A>(create: Rx.Read<Stream.Stream<R, E, A>> | Stream.Stream<R, E, A>, options?: {
Expand Down Expand Up @@ -617,15 +618,15 @@ export const fnSync: {
export const fn: {
<Arg, E, A>(fn: Rx.ReadFn<Arg, Effect.Effect<Scope.Scope, E, A>>, options?: {
readonly initialValue?: A
}): RxResultFn<E, A, Arg>
}): RxResultFn<E, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
<Arg, E, A>(fn: Rx.ReadFn<Arg, Stream.Stream<never, E, A>>, options?: {
readonly initialValue?: A
}): RxResultFn<E | NoSuchElementException, A, Arg>
}): RxResultFn<E | NoSuchElementException, A, Types.Equals<Arg, unknown> extends true ? void : Arg>
} = <Arg, E, A>(f: Rx.ReadFn<Arg, Stream.Stream<never, E, A> | Effect.Effect<Scope.Scope, E, A>>, options?: {
readonly initialValue?: A
}): RxResultFn<E | NoSuchElementException, A, Arg> => {
}): RxResultFn<E | NoSuchElementException, A, Types.Equals<Arg, unknown> extends true ? void : Arg> => {
const [read, write] = makeResultFn(f, options)
return writable(read, write)
return writable(read, write) as any
}

function makeResultFn<Arg, E, A>(
Expand Down

0 comments on commit e4da41a

Please sign in to comment.