Skip to content
Myr

fix(ts): Immer class options and ImmerState types

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Minor improvements

authored by aleclarson · committed by Alec Larson · parent 9c6603e · Browse files · 1 file+9 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−3 removed

  • other:+9 added−3 removed

1 file+9 added−3 removed

modified:src/immer.d.ts+9 added-3 removed
152 unmodified lines
153 * This function is a producer, which means copy-on-write is in effect.154 */155export function applyPatches<S>(base: S, patches: Patch[]): S156157/** Get the underlying object that is represented by the given draft */158export function original<T>(value: T): T | void159160/** For detecting an Immer draft */161export function isDraft(value: any): boolean162163export class Immer {164 constructor(config: {165 useProxies?: boolean166 autoFreeze?: boolean165 onAssign?: (state: ImmerState, prop: keyof any, value: any) => void166 onDelete?: (state: ImmerState, prop: keyof any) => void167 onAssign?: (168 state: ImmerState,169 prop: string | number,170 value: unknown171 ) => void172 onDelete?: (state: ImmerState, prop: string | number) => void173 onCopy?: (state: ImmerState) => void174 })175 /**176 * The `produce` function takes a value and a "recipe function" (whose
41 unmodified lines
218export interface ImmerState<T = any> {219 parent?: ImmerState220 base: T221 copy: T216 assigned: {[prop: string]: boolean}222 assigned: {[prop: string]: boolean; [index: number]: boolean}223}