Skip to content

Commit

Permalink
fix(ts): Immer class options and ImmerState types
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
aleclarson committed Jan 21, 2019
1 parent 9c6603e commit 5ff645c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/immer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,22 @@ export function setUseProxies(useProxies: boolean): void
*/
export function applyPatches<S>(base: S, patches: Patch[]): S

/** Get the underlying object that is represented by the given draft */
export function original<T>(value: T): T | void

/** For detecting an Immer draft */
export function isDraft(value: any): boolean

export class Immer {
constructor(config: {
useProxies?: boolean
autoFreeze?: boolean
onAssign?: (state: ImmerState, prop: keyof any, value: any) => void
onDelete?: (state: ImmerState, prop: keyof any) => void
onAssign?: (
state: ImmerState,
prop: string | number,
value: unknown
) => void
onDelete?: (state: ImmerState, prop: string | number) => void
onCopy?: (state: ImmerState) => void
})
/**
Expand Down Expand Up @@ -213,5 +219,5 @@ export interface ImmerState<T = any> {
parent?: ImmerState
base: T
copy: T
assigned: {[prop: string]: boolean}
assigned: {[prop: string]: boolean; [index: number]: boolean}
}

0 comments on commit 5ff645c

Please sign in to comment.