Skip to content
Myr

Fixed #492, finishDraft doesn't require two arguments

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 5d3a981 · Browse files · 3 files+10 added−6 removed
This commit

State

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

Diff stats

3 files+10 added−6 removed

  • other:+10 added−6 removed

3 files+10 added−6 removed

modified:src/immer.ts+2 added-2 removed
184 unmodified lines
185 }186187 finishDraft<D extends Draft<any>>(188 draft: D,189 patchListener: PatchListener189 patchListener?: PatchListener190 ): D extends Draft<infer T> ? T : never {191 const state = draft && draft[DRAFT_STATE]191 const state: ImmerState = draft && draft[DRAFT_STATE]192 if (!state || !state.isManual) {193 throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`") // prettier-ignore194 }195 if (state.finalized) {
78 unmodified lines
modified:src/scope.ts+1 added-1 removed
modified:tsconfig.json+7 added-3 removed