interface RefsWeakMap
extends WeakMap<Coder<unknown>, unknown>

A weak map interface for storing references in the encoding/decoding context.

This interface extends WeakMap to provide type-safe access to stored reference values using coders as keys. It ensures that the correct types are retrieved when accessing stored references.

Methods

get<T>(coder: Coder<T>): T | undefined

Gets a reference value for the given coder.

set<T>(
coder: Coder<T>,
value: T
): this

Sets a reference value for the given coder.

has<T>(coder: Coder<T>): boolean

Checks if a reference value exists for the given coder.

Usage

import { type RefsWeakMap } from "ref/ref.ts";