1 | import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
|
2 | import { IAnyType, IType, ExtractCSTWithSTN, IHooksGetter } from "../../internal";
|
3 |
|
4 | export interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<IT["CreationType"]> | undefined, IKeyValueMap<IT["SnapshotType"]>, IMSTMap<IT>> {
|
5 | hooks(hooks: IHooksGetter<IMSTMap<IT>>): IMapType<IT>;
|
6 | }
|
7 |
|
8 | export interface IMSTMap<IT extends IAnyType> {
|
9 | clear(): void;
|
10 | delete(key: string): boolean;
|
11 | forEach(callbackfn: (value: IT["Type"], key: string, map: this) => void, thisArg?: any): void;
|
12 | get(key: string): IT["Type"] | undefined;
|
13 | has(key: string): boolean;
|
14 | set(key: string, value: ExtractCSTWithSTN<IT>): this;
|
15 | readonly size: number;
|
16 | put(value: ExtractCSTWithSTN<IT>): IT["Type"];
|
17 | keys(): IterableIterator<string>;
|
18 | values(): IterableIterator<IT["Type"]>;
|
19 | entries(): IterableIterator<[string, IT["Type"]]>;
|
20 | [Symbol.iterator](): IterableIterator<[string, IT["Type"]]>;
|
21 |
|
22 | merge(other: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
|
23 | replace(values: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
|
24 | toJSON(): IKeyValueMap<IT["SnapshotType"]>;
|
25 | toString(): string;
|
26 | [Symbol.toStringTag]: "Map";
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 | observe(listener: (changes: IMapDidChange<string, IT["Type"]>) => void, fireImmediately?: boolean): Lambda;
|
33 | intercept(handler: IInterceptor<IMapWillChange<string, IT["Type"]>>): Lambda;
|
34 | }
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export declare function map<IT extends IAnyType>(subtype: IT): IMapType<IT>;
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | export declare function isMapType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IMapType<Items>;
|