Skip to content
Myr

types-internal.ts

This file

Path

src/types-internal.ts

54 lines · 1009 bytes · TypeScript

Last changed by

feat: general typing improvements for TS 3.7 and upMichel Weststratebefore adoptionf930ce1

History of this file

Take it

feat: general typing improvements for TS 3.7 and upMichel Weststratebefore adoptionf930ce1

lines 1–54why, one step back
1import {
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 {36 parent?: ImmerState37 scope: ImmerScope38 modified: boolean39 finalized: boolean40 isManual: boolean41}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