(u: unknown): u is Pool<unknown, unknown>Returns true if the specified value is a Pool, false otherwise.
When to use
Use to validate unknown values at runtime boundaries before treating them as
Pool values.
Details
This predicate narrows the input to Pool<unknown, unknown>.
export const const isPool: (
u: unknown
) => u is Pool<unknown, unknown>
Returns true if the specified value is a Pool, false otherwise.
When to use
Use to validate unknown values at runtime boundaries before treating them as
Pool values.
Details
This predicate narrows the input to Pool<unknown, unknown>.
isPool = (u: unknownu: unknown): u: unknownu is interface Pool<in out A, in out E = never>A Pool<A, E> is a pool of items of type A, each of which may be
associated with the acquisition and release of resources. An attempt to get
an item A from a pool may fail with an error of type E.
When to use
Use when you need to share a bounded set of scoped resources across fibers
while the pool manages acquisition, reuse, and release.
Pool<unknown, unknown> => hasProperty<"~effect/Pool">(self: unknown, property: "~effect/Pool"): self is { [K in "~effect/Pool"]: 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 TypeId: "~effect/Pool"TypeId)