diff --git a/src/runtime/motion/tweened.ts b/src/runtime/motion/tweened.ts index c802604c0e27..83434cdff62f 100644 --- a/src/runtime/motion/tweened.ts +++ b/src/runtime/motion/tweened.ts @@ -64,9 +64,9 @@ interface Options { type Updater = (target_value: T, value: T) => T; interface Tweened extends Readable { - set(value: T, opts: Options): Promise; + set(value: T, opts?: Options): Promise; - update(updater: Updater, opts: Options): Promise; + update(updater: Updater, opts?: Options): Promise; } export function tweened(value?: T, defaults: Options = {}): Tweened { @@ -75,7 +75,7 @@ export function tweened(value?: T, defaults: Options = {}): Tweened { let task: Task; let target_value = value; - function set(new_value: T, opts: Options) { + function set(new_value: T, opts?: Options) { if (value == null) { store.set(value = new_value); return Promise.resolve(); @@ -98,7 +98,7 @@ export function tweened(value?: T, defaults: Options = {}): Tweened { previous_task.abort(); previous_task = null; } - + store.set(value = target_value); return Promise.resolve(); } @@ -137,7 +137,7 @@ export function tweened(value?: T, defaults: Options = {}): Tweened { return { set, - update: (fn, opts: Options) => set(fn(target_value, value), opts), + update: (fn, opts?: Options) => set(fn(target_value, value), opts), subscribe: store.subscribe }; }