method ISession.set
ISession.set<T>(
key: string,
value: T
): void

Writes a value and marks the session for commit.

Passing undefined removes the key instead of storing it. undefined is not JSON-serializable, so storing it would make ISession.has report a key that serialization then drops — presence would be true before a commit and false after the next load.

Type Parameters

The value type

Parameters

key: string

Session key

value: T

Value to store; must be JSON-serializable. undefined removes the key

Return Type

void

Usage

import { type ISession } from "common/src/index.ts";