From ea157b7102fa043dfbaf840b52dc99d157829a14 Mon Sep 17 00:00:00 2001 From: David Arenas Date: Wed, 17 Jul 2024 10:08:08 +0200 Subject: [PATCH] Simplify PropSignal methods --- packages/interactivity/src/proxies/signals.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/interactivity/src/proxies/signals.ts b/packages/interactivity/src/proxies/signals.ts index 696b19eefc9ce4..2eb0cbf3803b7c 100644 --- a/packages/interactivity/src/proxies/signals.ts +++ b/packages/interactivity/src/proxies/signals.ts @@ -29,12 +29,12 @@ export class PropSignal { this.computedsByScope = new WeakMap(); } - public setValue( value: unknown ): PropSignal { - return this.update( { value } ); + public setValue( value: unknown ) { + this.update( { value } ); } - public setGetter( getter: () => any ): PropSignal { - return this.update( { get: getter } ); + public setGetter( getter: () => any ) { + this.update( { get: getter } ); } public getComputed(): ReadonlySignal { @@ -63,13 +63,7 @@ export class PropSignal { return this.computedsByScope.get( scope )!; } - private update( { - get, - value, - }: { - get?: () => any; - value?: unknown; - } ): PropSignal { + private update( { get, value }: { get?: () => any; value?: unknown } ) { if ( ! this.valueSignal ) { this.valueSignal = signal( value ); this.getterSignal = signal( get );