@benev/slate
Version:
frontend web stuff
18 lines (17 loc) • 627 B
TypeScript
export declare class MapG<K, V> extends Map<K, V> {
static require<K, V>(map: Map<K, V>, key: K): V & ({} | null);
static guarantee<K, V>(map: Map<K, V>, key: K, make: () => V): V;
array(): [K, V][];
require(key: K): V & ({} | null);
guarantee(key: K, make: () => V): V;
}
export type Identifiable<Id = any> = {
id: Id;
};
export declare class Pool<V extends Identifiable> extends MapG<V["id"], V> {
got(value: V): boolean;
add(value: V): V;
remove(value: V): boolean;
}
/** @deprecated renamed to `MapG`, to avoid confusion with vectors like Vec2 */
export declare const Map2: typeof MapG;