(input: unknown): input is ManagedRuntime<unknown, unknown>Checks whether the provided argument is a ManagedRuntime.
When to use
Use to narrow an unknown value before treating it as a ManagedRuntime.
Details
The guard checks the internal ManagedRuntime marker property. It does not
build the layer or inspect the runtime's services.
Gotchas
Disposed runtimes still carry the marker, so this guard does not prove the runtime is still usable.
export const const isManagedRuntime: (
input: unknown
) => input is ManagedRuntime<unknown, unknown>
Checks whether the provided argument is a ManagedRuntime.
When to use
Use to narrow an unknown value before treating it as a ManagedRuntime.
Details
The guard checks the internal ManagedRuntime marker property. It does not
build the layer or inspect the runtime's services.
Gotchas
Disposed runtimes still carry the marker, so this guard does not prove the
runtime is still usable.
isManagedRuntime = (input: unknowninput: unknown): input: unknowninput is interface ManagedRuntime<in R, out ER>Type helpers associated with ManagedRuntime.
When to use
Use to reference type-level helpers for extracting managed runtime services
and layer errors.
A runtime built from a layer that can execute effects requiring that layer's
services.
When to use
Use as the reusable runtime value returned by make when application entry
points or integration code need to run many effects against the same
layer-built services.
Details
The runtime builds and caches its service context and owns the scope for
resources acquired by the layer.
Gotchas
Dispose the runtime with dispose or disposeEffect when it is no longer
needed.
ManagedRuntime<unknown, unknown> =>
hasProperty<"~effect/ManagedRuntime">(self: unknown, property: "~effect/ManagedRuntime"): self is { [K in "~effect/ManagedRuntime"]: 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(input: unknowninput, const TypeId: "~effect/ManagedRuntime"TypeId)