@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface TypedStorage<T>

    A type-safe wrapper over a single Memento key.

    interface TypedStorage<T> {
        delete(): Promise<void>;
        dispose(): void;
        get(): T;
        has(): boolean;
        onDidChange(listener: (value: T) => void): { dispose(): void };
        reset(): Promise<void>;
        set(value: T): Promise<void>;
        tryGet(): Result<T, readonly StorageIssue[]>;
    }

    Type Parameters

    • T
    Index
    • Fires with the new effective value on set/reset/delete through this instance. Migration/legacy-move writes are silent. Mementos have no native change event, so writes from another window, process or accessor instance are not observable.

      Parameters

      • listener: (value: T) => void

      Returns { dispose(): void }

    • Resets to the default value (written as an entry — delete removes it). Like set, it rejects if the value fails the schema, which for this method means the declared default and the declared schema disagree.

      Returns Promise<void>

    • Sets the value with one Memento.update of the complete envelope.

      Rejects without writing when the value fails the schema. The read side is lenient — it falls back and records a diagnostic — so a write that skipped the check would not fail anywhere: the value would just be missing later, with the diagnostic pointing at the read instead of at the write. A schema that coerces has its output stored, so the next read agrees with it.

      Parameters

      • value: T

      Returns Promise<void>