types-internal.ts
This file
Path
src/types-internal.ts
54 lines · 1014 bytes · TypeScript
Last changed by
Mangle properties, -114 bytesMichel Weststratebefore adoptionbfa7ddd
History of this fileTake it
feat: general typing improvements for TS 3.7 and upMichel Weststratebefore adoptionf930ce1
lines 1–35why, one step back1import {2 SetState,3 ImmerScope,4 ProxyObjectState,5 ProxyArrayState,6 ES5ObjectState,7 ES5ArrayState,8 MapState,9 DRAFT_STATE10} from "./internal"1112export type Objectish = AnyObject | AnyArray | AnyMap | AnySet13export type ObjectishNoSet = AnyObject | AnyArray | AnyMap1415export type AnyObject = {[key: string]: any}16export type AnyArray = Array<any>17export type AnySet = Set<any>18export type AnyMap = Map<any, any>19export enum Archtype {20 Object,21 Array,22 Map,23 Set24}2526export enum ProxyType {27 ProxyObject,28 ProxyArray,29 ES5Object,30 ES5Array,31 Map,32 Set33}3435export interface ImmerBaseState {Mangle properties, -114 bytesMichel Weststratebefore adoptionbfa7ddd
lines 36–40why, one step back36 parent_?: ImmerState37 scope_: ImmerScope38 modified_: boolean39 finalized_: boolean40 isManual_: booleanfeat: general typing improvements for TS 3.7 and upMichel Weststratebefore adoptionf930ce1
lines 41–54why, one step back41}4243export type ImmerState =44 | ProxyObjectState45 | ProxyArrayState46 | ES5ObjectState47 | ES5ArrayState48 | MapState49 | SetState5051// The _internal_ type used for drafts (not to be confused with Draft, which is public facing)52export type Drafted<Base = any, T extends ImmerState = ImmerState> = {53 [DRAFT_STATE]: T54} & Base