(): voidReturns no meaningful value when called.
When to use
Use when you need a thunk that is called only for its effect and has no meaningful return value.
Example (Returning void from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constVoid(), undefined)constants
Source effect/Function.ts:4301 lines
export const const constVoid: LazyArg<void>Returns no meaningful value when called.
When to use
Use when you need a thunk that is called only for its effect and has no
meaningful return value.
Example (Returning void from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constVoid(), undefined)
constVoid: type LazyArg<A> = () => AA zero-argument function that produces a value when invoked.
When to use
Use to type a lazy value provider that should not run until called.
Example (Creating a lazy argument)
import { Function } from "effect"
const constNull: Function.LazyArg<null> = Function.constant(null)
LazyArg<void> = const constUndefined: LazyArg<undefined>Returns undefined when called.
When to use
Use when you need a thunk that returns undefined on every invocation.
Example (Returning undefined from a thunk)
import { Function } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(Function.constUndefined(), undefined)
constUndefinedReferenced by 9 symbols