From 2a0ed092f9c4a481a42d1c9b50166ac3ae1f6ce6 Mon Sep 17 00:00:00 2001 From: Bassam Ismail Date: Thu, 25 Jun 2020 08:48:19 +0530 Subject: [PATCH 1/2] fix(5062): make tweened options optional --- src/runtime/motion/tweened.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/motion/tweened.ts b/src/runtime/motion/tweened.ts index c802604c0e27..4e9705fe9695 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 }; } From 1bab7d7228b1b6548fa0e428d6fff197853290fa Mon Sep 17 00:00:00 2001 From: Conduitry Date: Thu, 25 Jun 2020 10:59:18 -0400 Subject: [PATCH 2/2] tidy --- src/runtime/motion/tweened.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/motion/tweened.ts b/src/runtime/motion/tweened.ts index 4e9705fe9695..83434cdff62f 100644 --- a/src/runtime/motion/tweened.ts +++ b/src/runtime/motion/tweened.ts @@ -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(); @@ -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 }; }