(u: unknown): u is Resource<unknown, unknown>Returns true if the specified value is a Resource.
When to use
Use to validate unknown values at runtime boundaries before treating them as
Resource values.
Details
This predicate narrows the input to Resource<unknown, unknown>.
export const const isResource: (
u: unknown
) => u is Resource<unknown, unknown>
Returns true if the specified value is a Resource.
When to use
Use to validate unknown values at runtime boundaries before treating them as
Resource values.
Details
This predicate narrows the input to Resource<unknown, unknown>.
isResource: (u: unknownu: unknown) => u: unknownu is interface Resource<in out A, in out E = never>A Resource is a value loaded into memory that can be refreshed manually or
automatically according to a schedule.
When to use
Use to model a scoped value whose latest acquisition result is kept available
for repeated reads and can be refreshed manually or on a schedule.
Resource<unknown, unknown> = (
u: unknownu: unknown
): u: unknownu is interface Resource<in out A, in out E = never>A Resource is a value loaded into memory that can be refreshed manually or
automatically according to a schedule.
When to use
Use to model a scoped value whose latest acquisition result is kept available
for repeated reads and can be refreshed manually or on a schedule.
Resource<unknown, unknown> => hasProperty<"~effect/Resource">(self: unknown, property: "~effect/Resource"): self is { [K in "~effect/Resource"]: 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/Resource"TypeId)