Renamed utils dir
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Michel Weststrate · committed by Michel Weststrate · parent db16520 · Browse files · 9 files·+403 added−403 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+403 added−403 removed
- other:+403 added−403 removed
Provenance
- Commit
edb1cad- Tree
5ec73af- Author
Michel Weststrate <mweststrate@fb.com>- Committer
Michel Weststrate <mweststrate@fb.com>- Parent
db16520
9 files changed+403 added−403 removed
deleted:src/crap/common.ts-192 removed
1-import {2- DRAFT_STATE,3- DRAFTABLE,4- hasSet,5- Objectish,6- Drafted,7- AnyObject,8- AnyArray,9- AnyMap,10- AnySet,11- ImmerState,12- hasMap,13- ArchtypeObject,14- ArchtypeArray,15- ArchtypeMap,16- ArchtypeSet,17- die18-} from "../internal"19-20-/** Returns true if the given value is an Immer draft */21-/*#__PURE__*/22-export function isDraft(value: any): boolean {23- return !!value && !!value[DRAFT_STATE]24-}25-26-/** Returns true if the given value can be drafted by Immer */27-/*#__PURE__*/28-export function isDraftable(value: any): boolean {29- if (!value) return false30- return (31- isPlainObject(value) ||32- Array.isArray(value) ||33- !!value[DRAFTABLE] ||34- !!value.constructor[DRAFTABLE] ||35- isMap(value) ||36- isSet(value)37- )38-}39-40-/*#__PURE__*/41-export function isPlainObject(value: any): boolean {42- if (!value || typeof value !== "object") return false43- const proto = Object.getPrototypeOf(value)44- return !proto || proto === Object.prototype45-}46-47-/** Get the underlying object that is represented by the given draft */48-/*#__PURE__*/49-export function original<T>(value: T): T | undefined50-export function original(value: Drafted<any>): any {51- if (value && value[DRAFT_STATE]) {52- return value[DRAFT_STATE].base_ as any53- }54- // otherwise return undefined55-}56-57-/*#__PURE__*/58-export const ownKeys: (target: AnyObject) => PropertyKey[] =59- typeof Reflect !== "undefined" && Reflect.ownKeys60- ? Reflect.ownKeys61- : typeof Object.getOwnPropertySymbols !== "undefined"62- ? obj =>63- Object.getOwnPropertyNames(obj).concat(64- Object.getOwnPropertySymbols(obj) as any65- )66- : /* istanbul ignore next */ Object.getOwnPropertyNames67-68-export function each<T extends Objectish>(69- obj: T,70- iter: (key: string | number, value: any, source: T) => void71-): void72-export function each(obj: any, iter: any) {73- if (getArchtype(obj) === ArchtypeObject) {74- ownKeys(obj).forEach(key => iter(key, obj[key], obj))75- } else {76- obj.forEach((entry: any, index: any) => iter(index, entry, obj))77- }78-}79-80-/*#__PURE__*/81-export function getArchtype(thing: any): 0 | 1 | 2 | 3 {82- /* istanbul ignore next */83- const state: undefined | ImmerState = thing[DRAFT_STATE]84- return state85- ? state.type_ > 386- ? state.type_ - 4 // cause Object and Array map back from 4 and 587- : (state.type_ as any) // others are the same88- : Array.isArray(thing)89- ? ArchtypeArray90- : isMap(thing)91- ? ArchtypeMap92- : isSet(thing)93- ? ArchtypeSet94- : ArchtypeObject95-}96-97-/*#__PURE__*/98-export function has(thing: any, prop: PropertyKey): boolean {99- return getArchtype(thing) === ArchtypeMap100- ? thing.has(prop)101- : Object.prototype.hasOwnProperty.call(thing, prop)102-}103-104-/*#__PURE__*/105-export function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {106- // @ts-ignore107- return getArchtype(thing) === ArchtypeMap ? thing.get(prop) : thing[prop]108-}109-110-/*#__PURE__*/111-export function set(thing: any, propOrOldValue: PropertyKey, value: any) {112- switch (getArchtype(thing)) {113- case ArchtypeMap:114- thing.set(propOrOldValue, value)115- break116- case ArchtypeSet:117- thing.delete(propOrOldValue)118- thing.add(value)119- break120- default:121- thing[propOrOldValue] = value122- }123-}124-125-/*#__PURE__*/126-export function is(x: any, y: any): boolean {127- // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js128- if (x === y) {129- return x !== 0 || 1 / x === 1 / y130- } else {131- return x !== x && y !== y132- }133-}134-135-/*#__PURE__*/136-export function isMap(target: any): target is AnyMap {137- return hasMap && target instanceof Map138-}139-140-/*#__PURE__*/141-export function isSet(target: any): target is AnySet {142- return hasSet && target instanceof Set143-}144-/*#__PURE__*/145-export function latest(state: ImmerState): any {146- return state.copy_ || state.base_147-}148-149-/*#__PURE__*/150-export function shallowCopy<T extends AnyObject | AnyArray>(151- base: T,152- invokeGetters?: boolean153-): T154-export function shallowCopy(base: any, invokeGetters = false) {155- if (Array.isArray(base)) return base.slice()156- const clone = Object.create(Object.getPrototypeOf(base))157- // TODO: each?158- ownKeys(base).forEach(key => {159- if (key === DRAFT_STATE) {160- return // Never copy over draft state.161- }162- const desc = Object.getOwnPropertyDescriptor(base, key)!163- let {value} = desc164- if (desc.get) {165- if (!invokeGetters) die(1)166- value = desc.get.call(base)167- }168- if (desc.enumerable) {169- clone[key] = value170- } else {171- Object.defineProperty(clone, key, {172- value,173- writable: true,174- configurable: true175- })176- }177- })178- return clone179-}180-181-export function freeze(obj: any, deep: boolean): void {182- if (isDraft(obj) || Object.isFrozen(obj) || !isDraftable(obj)) return183- if (getArchtype(obj) > 1 /* Map or Set */) {184- obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any185- }186- Object.freeze(obj)187- if (deep) each(obj, (_, value) => freeze(value, true))188-}189-190-function dontMutateFrozenCollections() {191- die(2)192-}deleted:src/crap/env.ts-48 removed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748// Should be no imports here!
// SOme things that should be evaluated before all else...const hasSymbol = typeof Symbol !== "undefined"export const hasMap = typeof Map !== "undefined"export const hasSet = typeof Set !== "undefined"export const hasProxies = typeof Proxy !== "undefined" && typeof Proxy.revocable !== "undefined" && typeof Reflect !== "undefined"
/* istanbul ignore next */function mini() {}export const isMinified = mini.name !== "mini"
/** * The sentinel value returned by producers to replace the draft with undefined. */export const NOTHING: Nothing = hasSymbol ? Symbol("immer-nothing") : ({["immer-nothing"]: true} as any)
/** * To let Immer treat your class instances as plain immutable objects * (albeit with a custom prototype), you must define either an instance property * or a static property on each of your custom classes. * * Otherwise, your class instance will never be drafted, which means it won't be * safe to mutate in a produce callback. */export const DRAFTABLE: unique symbol = hasSymbol ? Symbol("immer-draftable") : ("__$immer_draftable" as any)
export const DRAFT_STATE: unique symbol = hasSymbol ? Symbol("immer-state") : ("__$immer_state" as any)
export const iteratorSymbol: typeof Symbol.iterator = hasSymbol ? Symbol.iterator : ("@@iterator" as any)
/** Use a class type for `nothing` so its type is unique */export class Nothing { // This lets us do `Exclude<T, Nothing>` // @ts-ignore private _!: unique symbol}deleted:src/crap/errors.ts-51 removed
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051const errors = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3(data: any) { return ( "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data ) }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15(path: string) { return "Cannot apply patch, path doesn't resolve: " + path }, 16: 'Sets cannot have "replace" patches.', 17(op: string) { return "Unsupported patch operation: " + op }, 18(plugin: string) { return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.` }, 19: "plugin not loaded", 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available"} as const
export function die(error: keyof typeof errors, ...args: any[]): never { if (__DEV__) { const e = errors[error] const msg = !e ? "unknown error nr: " + error : typeof e === "function" ? e.apply(null, args as any) : e throw new Error(`[Immer] ${msg}`) } throw new Error( `[Immer] minified error nr: ${error}${ args.length ? " " + args.join(",") : "" }. Find the full error at: https://bit.ly/38PiBHb` )}deleted:src/crap/plugins.ts-108 removed
1-import {2- ImmerState,3- Patch,4- ImmerScope,5- Drafted,6- AnyObject,7- ImmerBaseState,8- AnyArray,9- AnyMap,10- AnySet,11- ProxyTypeES5Array,12- ProxyTypeES5Object,13- ProxyTypeMap,14- ProxyTypeSet,15- die16-} from "../internal"17-18-/** Plugin utilities */19-const plugins: {20- Patches?: {21- generatePatches_(22- state: ImmerState,23- basePath: PatchPath,24- patches: Patch[],25- inversePatches: Patch[]26- ): void27- applyPatches_<T>(draft: T, patches: Patch[]): T28- }29- ES5?: {30- willFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void31- createES5Proxy_<T>(32- base: T,33- parent?: ImmerState34- ): Drafted<T, ES5ObjectState | ES5ArrayState>35- markChangedES5_(state: ImmerState): void36- }37- MapSet?: {38- proxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T39- proxySet_<T extends AnySet>(target: T, parent?: ImmerState): T40- }41-} = {}42-43-type Plugins = typeof plugins44-45-export function getPlugin<K extends keyof Plugins>(46- pluginKey: K47-): Exclude<Plugins[K], undefined> {48- const plugin = plugins[pluginKey]49- if (!plugin) {50- die(__DEV__ ? 18 : 19, pluginKey)51- }52- // @ts-ignore53- return plugin54-}55-56-export function loadPlugin<K extends keyof Plugins>(57- pluginKey: K,58- implementation: Plugins[K]59-): void {60- plugins[pluginKey] = implementation61-}62-63-/** ES5 Plugin */64-65-interface ES5BaseState extends ImmerBaseState {66- finalizing_: boolean67- assigned_: {[key: string]: any}68- parent_?: ImmerState69- revoked_: boolean70-}71-72-export interface ES5ObjectState extends ES5BaseState {73- type_: typeof ProxyTypeES5Object74- draft_: Drafted<AnyObject, ES5ObjectState>75- base_: AnyObject76- copy_: AnyObject | null77-}78-79-export interface ES5ArrayState extends ES5BaseState {80- type_: typeof ProxyTypeES5Array81- draft_: Drafted<AnyObject, ES5ArrayState>82- base_: AnyArray83- copy_: AnyArray | null84-}85-86-/** Map / Set plugin */87-88-export interface MapState extends ImmerBaseState {89- type_: typeof ProxyTypeMap90- copy_: AnyMap | undefined91- assigned_: Map<any, boolean> | undefined92- base_: AnyMap93- revoked_: boolean94- draft_: Drafted<AnyMap, MapState>95-}96-97-export interface SetState extends ImmerBaseState {98- type_: typeof ProxyTypeSet99- copy_: AnySet | undefined100- base_: AnySet101- drafts_: Map<any, Drafted> // maps the original value to the draft value in the new set102- revoked_: boolean103- draft_: Drafted<AnySet, SetState>104-}105-106-/** Patches plugin */107-108-export type PatchPath = (string | number)[]added:src/utils/common.ts+192 added
1+import {2+ DRAFT_STATE,3+ DRAFTABLE,4+ hasSet,5+ Objectish,6+ Drafted,7+ AnyObject,8+ AnyArray,9+ AnyMap,10+ AnySet,11+ ImmerState,12+ hasMap,13+ ArchtypeObject,14+ ArchtypeArray,15+ ArchtypeMap,16+ ArchtypeSet,17+ die18+} from "../internal"19+20+/** Returns true if the given value is an Immer draft */21+/*#__PURE__*/22+export function isDraft(value: any): boolean {23+ return !!value && !!value[DRAFT_STATE]24+}25+26+/** Returns true if the given value can be drafted by Immer */27+/*#__PURE__*/28+export function isDraftable(value: any): boolean {29+ if (!value) return false30+ return (31+ isPlainObject(value) ||32+ Array.isArray(value) ||33+ !!value[DRAFTABLE] ||34+ !!value.constructor[DRAFTABLE] ||35+ isMap(value) ||36+ isSet(value)37+ )38+}39+40+/*#__PURE__*/41+export function isPlainObject(value: any): boolean {42+ if (!value || typeof value !== "object") return false43+ const proto = Object.getPrototypeOf(value)44+ return !proto || proto === Object.prototype45+}46+47+/** Get the underlying object that is represented by the given draft */48+/*#__PURE__*/49+export function original<T>(value: T): T | undefined50+export function original(value: Drafted<any>): any {51+ if (value && value[DRAFT_STATE]) {52+ return value[DRAFT_STATE].base_ as any53+ }54+ // otherwise return undefined55+}56+57+/*#__PURE__*/58+export const ownKeys: (target: AnyObject) => PropertyKey[] =59+ typeof Reflect !== "undefined" && Reflect.ownKeys60+ ? Reflect.ownKeys61+ : typeof Object.getOwnPropertySymbols !== "undefined"62+ ? obj =>63+ Object.getOwnPropertyNames(obj).concat(64+ Object.getOwnPropertySymbols(obj) as any65+ )66+ : /* istanbul ignore next */ Object.getOwnPropertyNames67+68+export function each<T extends Objectish>(69+ obj: T,70+ iter: (key: string | number, value: any, source: T) => void71+): void72+export function each(obj: any, iter: any) {73+ if (getArchtype(obj) === ArchtypeObject) {74+ ownKeys(obj).forEach(key => iter(key, obj[key], obj))75+ } else {76+ obj.forEach((entry: any, index: any) => iter(index, entry, obj))77+ }78+}79+80+/*#__PURE__*/81+export function getArchtype(thing: any): 0 | 1 | 2 | 3 {82+ /* istanbul ignore next */83+ const state: undefined | ImmerState = thing[DRAFT_STATE]84+ return state85+ ? state.type_ > 386+ ? state.type_ - 4 // cause Object and Array map back from 4 and 587+ : (state.type_ as any) // others are the same88+ : Array.isArray(thing)89+ ? ArchtypeArray90+ : isMap(thing)91+ ? ArchtypeMap92+ : isSet(thing)93+ ? ArchtypeSet94+ : ArchtypeObject95+}96+97+/*#__PURE__*/98+export function has(thing: any, prop: PropertyKey): boolean {99+ return getArchtype(thing) === ArchtypeMap100+ ? thing.has(prop)101+ : Object.prototype.hasOwnProperty.call(thing, prop)102+}103+104+/*#__PURE__*/105+export function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {106+ // @ts-ignore107+ return getArchtype(thing) === ArchtypeMap ? thing.get(prop) : thing[prop]108+}109+110+/*#__PURE__*/111+export function set(thing: any, propOrOldValue: PropertyKey, value: any) {112+ switch (getArchtype(thing)) {113+ case ArchtypeMap:114+ thing.set(propOrOldValue, value)115+ break116+ case ArchtypeSet:117+ thing.delete(propOrOldValue)118+ thing.add(value)119+ break120+ default:121+ thing[propOrOldValue] = value122+ }123+}124+125+/*#__PURE__*/126+export function is(x: any, y: any): boolean {127+ // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js128+ if (x === y) {129+ return x !== 0 || 1 / x === 1 / y130+ } else {131+ return x !== x && y !== y132+ }133+}134+135+/*#__PURE__*/136+export function isMap(target: any): target is AnyMap {137+ return hasMap && target instanceof Map138+}139+140+/*#__PURE__*/141+export function isSet(target: any): target is AnySet {142+ return hasSet && target instanceof Set143+}144+/*#__PURE__*/145+export function latest(state: ImmerState): any {146+ return state.copy_ || state.base_147+}148+149+/*#__PURE__*/150+export function shallowCopy<T extends AnyObject | AnyArray>(151+ base: T,152+ invokeGetters?: boolean153+): T154+export function shallowCopy(base: any, invokeGetters = false) {155+ if (Array.isArray(base)) return base.slice()156+ const clone = Object.create(Object.getPrototypeOf(base))157+ // TODO: each?158+ ownKeys(base).forEach(key => {159+ if (key === DRAFT_STATE) {160+ return // Never copy over draft state.161+ }162+ const desc = Object.getOwnPropertyDescriptor(base, key)!163+ let {value} = desc164+ if (desc.get) {165+ if (!invokeGetters) die(1)166+ value = desc.get.call(base)167+ }168+ if (desc.enumerable) {169+ clone[key] = value170+ } else {171+ Object.defineProperty(clone, key, {172+ value,173+ writable: true,174+ configurable: true175+ })176+ }177+ })178+ return clone179+}180+181+export function freeze(obj: any, deep: boolean): void {182+ if (isDraft(obj) || Object.isFrozen(obj) || !isDraftable(obj)) return183+ if (getArchtype(obj) > 1 /* Map or Set */) {184+ obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections as any185+ }186+ Object.freeze(obj)187+ if (deep) each(obj, (_, value) => freeze(value, true))188+}189+190+function dontMutateFrozenCollections() {191+ die(2)192+}added:src/utils/env.ts+48 added
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748// Should be no imports here!
// SOme things that should be evaluated before all else...const hasSymbol = typeof Symbol !== "undefined"export const hasMap = typeof Map !== "undefined"export const hasSet = typeof Set !== "undefined"export const hasProxies = typeof Proxy !== "undefined" && typeof Proxy.revocable !== "undefined" && typeof Reflect !== "undefined"
/* istanbul ignore next */function mini() {}export const isMinified = mini.name !== "mini"
/** * The sentinel value returned by producers to replace the draft with undefined. */export const NOTHING: Nothing = hasSymbol ? Symbol("immer-nothing") : ({["immer-nothing"]: true} as any)
/** * To let Immer treat your class instances as plain immutable objects * (albeit with a custom prototype), you must define either an instance property * or a static property on each of your custom classes. * * Otherwise, your class instance will never be drafted, which means it won't be * safe to mutate in a produce callback. */export const DRAFTABLE: unique symbol = hasSymbol ? Symbol("immer-draftable") : ("__$immer_draftable" as any)
export const DRAFT_STATE: unique symbol = hasSymbol ? Symbol("immer-state") : ("__$immer_state" as any)
export const iteratorSymbol: typeof Symbol.iterator = hasSymbol ? Symbol.iterator : ("@@iterator" as any)
/** Use a class type for `nothing` so its type is unique */export class Nothing { // This lets us do `Exclude<T, Nothing>` // @ts-ignore private _!: unique symbol}added:src/utils/errors.ts+51 added
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051const errors = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3(data: any) { return ( "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data ) }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15(path: string) { return "Cannot apply patch, path doesn't resolve: " + path }, 16: 'Sets cannot have "replace" patches.', 17(op: string) { return "Unsupported patch operation: " + op }, 18(plugin: string) { return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.` }, 19: "plugin not loaded", 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available"} as const
export function die(error: keyof typeof errors, ...args: any[]): never { if (__DEV__) { const e = errors[error] const msg = !e ? "unknown error nr: " + error : typeof e === "function" ? e.apply(null, args as any) : e throw new Error(`[Immer] ${msg}`) } throw new Error( `[Immer] minified error nr: ${error}${ args.length ? " " + args.join(",") : "" }. Find the full error at: https://bit.ly/38PiBHb` )}added:src/utils/plugins.ts+108 added
1+import {2+ ImmerState,3+ Patch,4+ ImmerScope,5+ Drafted,6+ AnyObject,7+ ImmerBaseState,8+ AnyArray,9+ AnyMap,10+ AnySet,11+ ProxyTypeES5Array,12+ ProxyTypeES5Object,13+ ProxyTypeMap,14+ ProxyTypeSet,15+ die16+} from "../internal"17+18+/** Plugin utilities */19+const plugins: {20+ Patches?: {21+ generatePatches_(22+ state: ImmerState,23+ basePath: PatchPath,24+ patches: Patch[],25+ inversePatches: Patch[]26+ ): void27+ applyPatches_<T>(draft: T, patches: Patch[]): T28+ }29+ ES5?: {30+ willFinalizeES5_(scope: ImmerScope, result: any, isReplaced: boolean): void31+ createES5Proxy_<T>(32+ base: T,33+ parent?: ImmerState34+ ): Drafted<T, ES5ObjectState | ES5ArrayState>35+ markChangedES5_(state: ImmerState): void36+ }37+ MapSet?: {38+ proxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T39+ proxySet_<T extends AnySet>(target: T, parent?: ImmerState): T40+ }41+} = {}42+43+type Plugins = typeof plugins44+45+export function getPlugin<K extends keyof Plugins>(46+ pluginKey: K47+): Exclude<Plugins[K], undefined> {48+ const plugin = plugins[pluginKey]49+ if (!plugin) {50+ die(__DEV__ ? 18 : 19, pluginKey)51+ }52+ // @ts-ignore53+ return plugin54+}55+56+export function loadPlugin<K extends keyof Plugins>(57+ pluginKey: K,58+ implementation: Plugins[K]59+): void {60+ plugins[pluginKey] = implementation61+}62+63+/** ES5 Plugin */64+65+interface ES5BaseState extends ImmerBaseState {66+ finalizing_: boolean67+ assigned_: {[key: string]: any}68+ parent_?: ImmerState69+ revoked_: boolean70+}71+72+export interface ES5ObjectState extends ES5BaseState {73+ type_: typeof ProxyTypeES5Object74+ draft_: Drafted<AnyObject, ES5ObjectState>75+ base_: AnyObject76+ copy_: AnyObject | null77+}78+79+export interface ES5ArrayState extends ES5BaseState {80+ type_: typeof ProxyTypeES5Array81+ draft_: Drafted<AnyObject, ES5ArrayState>82+ base_: AnyArray83+ copy_: AnyArray | null84+}85+86+/** Map / Set plugin */87+88+export interface MapState extends ImmerBaseState {89+ type_: typeof ProxyTypeMap90+ copy_: AnyMap | undefined91+ assigned_: Map<any, boolean> | undefined92+ base_: AnyMap93+ revoked_: boolean94+ draft_: Drafted<AnyMap, MapState>95+}96+97+export interface SetState extends ImmerBaseState {98+ type_: typeof ProxyTypeSet99+ copy_: AnySet | undefined100+ base_: AnySet101+ drafts_: Map<any, Drafted> // maps the original value to the draft value in the new set102+ revoked_: boolean103+ draft_: Drafted<AnySet, SetState>104+}105+106+/** Patches plugin */107+108+export type PatchPath = (string | number)[]modified:src/internal.ts+4 added-4 removed
121234565678910export * from "./crap/env"export * from "./crap/errors"export * from "./utils/env"export * from "./utils/errors"export * from "./types/types-external"export * from "./types/types-internal"export * from "./crap/common"export * from "./crap/plugins"export * from "./utils/common"export * from "./utils/plugins"export * from "./core/scope"export * from "./core/finalize"export * from "./core/proxy"export * from "./core/immerClass"