<A = unknown, E = unknown>(u: unknown): u is TxDequeue<A, E>Checks whether the given value is a TxDequeue.
Example (Checking dequeue handles)
import { TxQueue } from "effect"
declare const someValue: unknown
if (TxQueue.isTxDequeue(someValue)) {
// someValue is now typed as TxDequeue<unknown, unknown>
console.log("This is a TxDequeue")
}guards
Source effect/TxQueue.ts:2881 lines
export const const isTxDequeue: <
A = unknown,
E = unknown
>(
u: unknown
) => u is TxDequeue<A, E>
Checks whether the given value is a TxDequeue.
Example (Checking dequeue handles)
import { TxQueue } from "effect"
declare const someValue: unknown
if (TxQueue.isTxDequeue(someValue)) {
// someValue is now typed as TxDequeue<unknown, unknown>
console.log("This is a TxDequeue")
}
isTxDequeue = <function (type parameter) A in <A = unknown, E = unknown>(u: unknown): u is TxDequeue<A, E>A = unknown, function (type parameter) E in <A = unknown, E = unknown>(u: unknown): u is TxDequeue<A, E>E = unknown>(u: unknownu: unknown): u: unknownu is interface TxDequeue<out A, out E = never>Namespace containing type definitions for TxDequeue variance annotations.
A TxDequeue represents the read-only interface of a transactional queue, providing
operations for consuming elements (dequeue operations) and inspecting queue state.
Example (Taking values through dequeue handles)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
// Queue without error channel
const queue = yield* TxQueue.bounded<number>(10)
yield* TxQueue.offer(queue, 42)
const item = yield* TxQueue.take(queue)
console.log(item) // 42
// Queue with error channel - errors propagate through E-channel
const faultTolerantQueue = yield* TxQueue.bounded<number, string>(10)
yield* TxQueue.fail(faultTolerantQueue, "processing failed")
// All dequeue operations now fail with the error directly
const takeResult = yield* Effect.flip(TxQueue.take(faultTolerantQueue)) // "processing failed"
const peekResult = yield* Effect.flip(TxQueue.peek(faultTolerantQueue)) // "processing failed"
})
TxDequeue<function (type parameter) A in <A = unknown, E = unknown>(u: unknown): u is TxDequeue<A, E>A, function (type parameter) E in <A = unknown, E = unknown>(u: unknown): u is TxDequeue<A, E>E> => hasProperty<"~effect/transactions/TxQueue/Dequeue">(self: unknown, property: "~effect/transactions/TxQueue/Dequeue"): self is { [K in "~effect/transactions/TxQueue/Dequeue"]: unknown; } (+1 overload)Checks whether a value has a given property key.
When to use
Use when you need a Predicate guard for property access on unknown
values with a simple structural object check.
Details
Uses the in operator and isObjectKeyword. This does not check property
value types.
Example (Guarding object properties)
import { Predicate } from "effect"
const hasName = Predicate.hasProperty("name")
const data: unknown = { name: "Ada" }
if (hasName(data)) {
console.log(data.name)
}
hasProperty(u: unknownu, const DequeueTypeId: "~effect/transactions/TxQueue/Dequeue"DequeueTypeId)