diff --git a/src/immer.d.ts b/src/immer.d.ts index 44bbf094..216a7259 100644 --- a/src/immer.d.ts +++ b/src/immer.d.ts @@ -157,9 +157,12 @@ export function applyPatches(base: S, patches: Patch[]): S /** Get the underlying object that is represented by the given draft */ export function original(value: T): T | void -/** For detecting an Immer draft */ +/** Returns true if the given value is an Immer draft */ export function isDraft(value: any): boolean +/** Returns true if the given value can be drafted by Immer */ +export function isDraftable(value: any): boolean + export class Immer { constructor(config: { useProxies?: boolean diff --git a/src/index.js b/src/index.js index 990c0a9b..f864a225 100644 --- a/src/index.js +++ b/src/index.js @@ -50,6 +50,7 @@ export const applyPatches = produce(applyPatchesImpl) export { original, isDraft, + isDraftable, NOTHING as nothing, DRAFTABLE as immerable } from "./common"