mirror of
https://github.com/langgenius/dify.git
synced 2026-07-24 04:58:32 +08:00
8 lines
290 B
TypeScript
8 lines
290 B
TypeScript
export type DraftFieldUpdate<Value> = Value | ((currentValue: Value) => Value)
|
|
|
|
export const resolveDraftFieldUpdate = <Value>(
|
|
currentValue: Value,
|
|
update: DraftFieldUpdate<Value>,
|
|
) =>
|
|
typeof update === 'function' ? (update as (currentValue: Value) => Value)(currentValue) : update
|