(u: unknown): u is FiberMap<unknown>Returns true if a value is a FiberMap.
Details
This is a type guard that checks for the FiberMap runtime marker.
Example (Checking if a value is a FiberMap)
import { Effect, FiberMap } from "effect"
const program = Effect.gen(function*() {
const map = yield* FiberMap.make<string>()
console.log(FiberMap.isFiberMap(map)) // true
console.log(FiberMap.isFiberMap({})) // false
console.log(FiberMap.isFiberMap(null)) // false
})refinements
Source effect/FiberMap.ts:951 lines
export const const isFiberMap: (
u: unknown
) => u is FiberMap<unknown>
Returns true if a value is a FiberMap.
Details
This is a type guard that checks for the FiberMap runtime marker.
Example (Checking if a value is a FiberMap)
import { Effect, FiberMap } from "effect"
const program = Effect.gen(function*() {
const map = yield* FiberMap.make<string>()
console.log(FiberMap.isFiberMap(map)) // true
console.log(FiberMap.isFiberMap({})) // false
console.log(FiberMap.isFiberMap(null)) // false
})
isFiberMap = (u: unknownu: unknown): u: unknownu is interface FiberMap<in out K, out A = unknown, out E = unknown>A FiberMap is a collection of fibers, indexed by a key. When the associated
Scope is closed, all fibers in the map will be interrupted. Fibers are
automatically removed from the map when they complete.
Example (Managing fibers in a map)
import { Effect, FiberMap } from "effect"
// Create a FiberMap with string keys
const program = Effect.gen(function*() {
const map = yield* FiberMap.make<string>()
// Add some fibers to the map
yield* FiberMap.run(map, "task1", Effect.never)
yield* FiberMap.run(map, "task2", Effect.never)
// Get the size of the map
const size = yield* FiberMap.size(map)
console.log(size) // 2
})
FiberMap<unknown> => import PredicatePredicate.const hasProperty: <"~effect/FiberMap">(self: unknown, property: "~effect/FiberMap") => self is { [K in "~effect/FiberMap"]: unknown; } (+1 overload)hasProperty(u: unknownu, const TypeId: "~effect/FiberMap"TypeId)Referenced by 2 symbols