(u: unknown): u is HashRing<any>Checks whether a value is a HashRing.
When to use
Use to narrow an unknown value before treating it as a HashRing, such as
values crossing an untyped boundary.
Details
The guard checks for the module's internal TypeId property and narrows to
HashRing<any>.
Gotchas
This is a structural type-id check; it does not validate the ring's nodes,
ring, or weight state.
export const const isHashRing: (
u: unknown
) => u is HashRing<any>
Checks whether a value is a HashRing.
When to use
Use to narrow an unknown value before treating it as a HashRing, such as
values crossing an untyped boundary.
Details
The guard checks for the module's internal TypeId property and narrows to
HashRing<any>.
Gotchas
This is a structural type-id check; it does not validate the ring's nodes,
ring, or weight state.
isHashRing = (u: unknownu: unknown): u: unknownu is interface HashRing<A extends PrimaryKey.PrimaryKey>A weighted consistent-hashing ring for assigning inputs to nodes with stable
remapping as nodes are added or removed.
When to use
Use to maintain a mutable weighted hash ring for routing keys or shards to
nodes identified by PrimaryKey.
Details
Nodes are identified by their PrimaryKey value and can be iterated from the
ring.
HashRing<any> => hasProperty<"~effect/cluster/HashRing">(self: unknown, property: "~effect/cluster/HashRing"): self is { [K in "~effect/cluster/HashRing"]: 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/cluster/HashRing"TypeId)