Skip to content
Myr

index.d.ts

This file

Path

index.d.ts

10 lines · 611 bytes · TypeScript

Last changed by

Merge pull request #11 from benbraou/issue5Michel Weststratebefore adoption81d9d78

History of this file

Take it

Merge pull request #11 from benbraou/issue5Michel Weststratebefore adoption81d9d78

lines 1–10why, one step back
1/**
2 * Immer takes a state, and runs a function against it.3 * That function can freely mutate the state, as it will create copies-on-write.4 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned5 * 6 * @param currentState - the state to start with7 * @param thunk - function that receives a proxy of the current state as first argument and which can be freely modified8 * @returns The next state: a new state, or the current state if nothing was modified9 */10export function immer<S = any>(currentState: S, thunk: (draftState: S) => void): S;