mobx-keystone
Version:
A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more
35 lines (34 loc) • 1.32 kB
TypeScript
declare const ObjectMap_base: import('../model/Model')._Model<unknown, {
$modelId: import('../modelShared/prop').ModelIdProp<string> & {
typedAs<T extends string>(): import('../modelShared/prop').ModelIdProp<T>;
};
items: import('../modelShared/prop').OptionalModelProp<{
[k: string]: any;
}>;
}, never, never>;
/**
* A map that is backed by an object-like map.
* Use `objectMap` to create it.
*/
export declare class ObjectMap<V> extends ObjectMap_base implements Map<string, V> {
clear(): void;
delete(key: string): boolean;
forEach(callbackfn: (value: V, key: string, map: Map<string, V>) => void, thisArg?: any): void;
get(key: string): V | undefined;
has(key: string): boolean;
set(key: string, value: V): this;
get size(): number;
keys(): ReturnType<Map<string, V>["keys"]>;
values(): ReturnType<Map<string, V>["values"]>;
entries(): ReturnType<Map<string, V>["entries"]>;
[Symbol.iterator](): ReturnType<Map<string, V>[typeof Symbol.iterator]>;
readonly [Symbol.toStringTag] = "ObjectMap";
}
/**
* Creates a new ObjectMap model instance.
*
* @template V Value type.
* @param [entries] Optional initial values.
*/
export declare function objectMap<V>(entries?: ReadonlyArray<readonly [string, V]> | null): ObjectMap<V>;
export {};