rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
25 lines • 1.19 kB
TypeScript
import { TKeysOf } from "../typescript/t-keys-of.js";
import { TTypedArrayCtor } from "../array/typed-array/t-typed-array-ctor.js";
import { IDebugProtectedViewFactory } from "./i-debug-protected-view-factory.js";
/**
* @public
* Provides a view of an object that can be invalidated, causing attempts to access it to error in `_BUILD.DEBUG`.
*
* @remarks
* Allows the specification of `safeKeys`, accessing of these is not an error regardless of invalidation state.
*/
export declare class DebugProtectedView<TView extends object> implements IDebugProtectedViewFactory {
private readonly debugInfo;
private readonly safeKeys;
static createTypedArrayView: <TCtor extends TTypedArrayCtor>(instanceName: string) => DebugProtectedView<InstanceType<TCtor>>;
constructor(debugInfo: string, safeKeys?: TKeysOf<TView>);
debugOnAllocate(): void;
invalidate(): void;
createProtectedView<T extends object>(view: T): T;
static unwrapProtectedView<T extends object>(view: T): T;
private validViews;
private static isViewValidKey;
private static originalViewKey;
private static debugMessageKey;
}
//# sourceMappingURL=debug-protected-view.d.ts.map