<A = unknown, E = unknown>(u: unknown): u is TxEnqueue<A, E>Checks whether the given value is a TxEnqueue.
Example (Checking enqueue handles)
import { TxQueue } from "effect"
declare const someValue: unknown
if (TxQueue.isTxEnqueue(someValue)) {
// someValue is now typed as TxEnqueue<unknown, unknown>
console.log("This is a TxEnqueue")
}guards
Source effect/TxQueue.ts:2671 lines
export const const isTxEnqueue: <
A = unknown,
E = unknown
>(
u: unknown
) => u is TxEnqueue<A, E>
Checks whether the given value is a TxEnqueue.
Example (Checking enqueue handles)
import { TxQueue } from "effect"
declare const someValue: unknown
if (TxQueue.isTxEnqueue(someValue)) {
// someValue is now typed as TxEnqueue<unknown, unknown>
console.log("This is a TxEnqueue")
}
isTxEnqueue = <function (type parameter) A in <A = unknown, E = unknown>(u: unknown): u is TxEnqueue<A, E>A = unknown, function (type parameter) E in <A = unknown, E = unknown>(u: unknown): u is TxEnqueue<A, E>E = unknown>(u: unknownu: unknown): u: unknownu is interface TxEnqueue<in A, in E = never>Namespace containing type definitions for TxEnqueue variance annotations.
A TxEnqueue represents the write-only interface of a transactional queue, providing
operations for adding elements (enqueue operations) and inspecting queue state.
Example (Offering values through enqueue handles)
import { Effect, TxQueue } from "effect"
import type { Cause } from "effect"
const program = Effect.gen(function*() {
// Queue without error channel
const queue = yield* TxQueue.bounded<number>(10)
const accepted = yield* TxQueue.offer(queue, 42)
// Queue with error channel for completion signaling
const faultTolerantQueue = yield* TxQueue.bounded<number, string>(10)
yield* TxQueue.offerAll(faultTolerantQueue, [1, 2, 3])
yield* TxQueue.fail(faultTolerantQueue, "processing complete")
// Works with Done for clean completion
const completableQueue = yield* TxQueue.bounded<
string,
Cause.Done
>(5)
yield* TxQueue.offer(completableQueue, "task")
yield* TxQueue.end(completableQueue)
})
TxEnqueue<function (type parameter) A in <A = unknown, E = unknown>(u: unknown): u is TxEnqueue<A, E>A, function (type parameter) E in <A = unknown, E = unknown>(u: unknown): u is TxEnqueue<A, E>E> => import hasPropertyhasProperty(u: unknownu, const EnqueueTypeId: "~effect/transactions/TxQueue/Enqueue"EnqueueTypeId)