(tag: unknown): HandoffStrategy | undefinedRead a tag's withHandoff strategy, if any.
export const const handoffOf: (
tag: unknown
) => HandoffStrategy | undefined
Read a tag's
withHandoff
strategy, if any.
handoffOf = (tag: unknowntag: unknown): type HandoffStrategy =
| "drainOnly"
| "workPoolRelease"
Opt-in cutover strategy for
withHandoff
(Locked #33).
camelCase option strings — same family as OnConflict / WorkPool shutdownMode
(PascalCase is reserved for _tag discriminants).
HandoffStrategy | undefined => {
if (!import PredicatePredicate.const hasProperty: <typeof handoffSym>(self: unknown, property: typeof handoffSym) => self is { [K in typeof handoffSym]: 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(tag: unknowntag, const handoffSym: typeof handoffSymWhere a HyperService's opt-in cutover strategy is stowed — applied by
withHandoff
.
Absent ⇒ not migrated by Track C (#29).
handoffSym)) return var undefinedundefined;
const const value: unknownvalue = tag: {
[handoffSym]: unknown
}
tag[const handoffSym: typeof handoffSymWhere a HyperService's opt-in cutover strategy is stowed — applied by
withHandoff
.
Absent ⇒ not migrated by Track C (#29).
handoffSym];
if (const value: unknownvalue === "drainOnly" || const value: unknownvalue === "workPoolRelease") return const value:
| "drainOnly"
| "workPoolRelease"
value;
return var undefinedundefined;
};