UNPKG

866 BPlain TextView Raw
1import {
2 SetState,
3 ImmerScope,
4 ProxyObjectState,
5 ProxyArrayState,
6 MapState,
7 DRAFT_STATE
8} from "../internal"
9
10export type Objectish = AnyObject | AnyArray | AnyMap | AnySet
11export type ObjectishNoSet = AnyObject | AnyArray | AnyMap
12
13export type AnyObject = {[key: string]: any}
14export type AnyArray = Array<any>
15export type AnySet = Set<any>
16export type AnyMap = Map<any, any>
17
18export const enum ArchType {
19 Object,
20 Array,
21 Map,
22 Set
23}
24
25export interface ImmerBaseState {
26 parent_?: ImmerState
27 scope_: ImmerScope
28 modified_: boolean
29 finalized_: boolean
30 isManual_: boolean
31}
32
33export type ImmerState =
34 | ProxyObjectState
35 | ProxyArrayState
36 | MapState
37 | SetState
38
39// The _internal_ type used for drafts (not to be confused with Draft, which is public facing)
40export type Drafted<Base = any, T extends ImmerState = ImmerState> = {
41 [DRAFT_STATE]: T
42} & Base