(u: unknown): u is Graph<unknown, unknown>Returns true if a value has the graph runtime type identifier, narrowing
it to a Graph.
When to use
Use to narrow an unknown value before treating it as a graph value.
Gotchas
This guard checks the shared graph runtime type identifier and does not distinguish immutable graphs from mutable graphs.
export const const isGraph: (
u: unknown
) => u is Graph<unknown, unknown>
Returns true if a value has the graph runtime type identifier, narrowing
it to a Graph.
When to use
Use to narrow an unknown value before treating it as a graph value.
Gotchas
This guard checks the shared graph runtime type identifier and does not
distinguish immutable graphs from mutable graphs.
isGraph = (u: unknownu: unknown): u: unknownu is interface Graph<out N, out E, T extends Kind = "directed">Immutable graph interface.
When to use
Use as the immutable graph model for code that queries, traverses,
transforms, or analyzes graph structure without mutating it.
Graph<unknown, unknown> => hasProperty<"~effect/collections/Graph">(self: unknown, property: "~effect/collections/Graph"): self is { [K in "~effect/collections/Graph"]: 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/collections/Graph"TypeId)