From ab75df41ef00614a1c771b4b64ea81ee56955345 Mon Sep 17 00:00:00 2001 From: Olaf Tietze Date: Fri, 28 Jul 2023 12:24:22 +0000 Subject: [PATCH] remove resursion from util/component --- .../src/lib/component/with-component-ref.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libs/util/src/lib/component/with-component-ref.ts b/libs/util/src/lib/component/with-component-ref.ts index ea521d2..581e6e1 100644 --- a/libs/util/src/lib/component/with-component-ref.ts +++ b/libs/util/src/lib/component/with-component-ref.ts @@ -1,17 +1,12 @@ import { ComponentRef } from '@angular/core'; /** - * Type-safely assign values to your ComponentRef's @Input decorated properties. - * You can also chain input assignments - * - * @example - * setComponentRefInput(componenRef).setInput(key, value).setInput(key, value)... + * Type-safely assign values to your ComponentRef's @Input decorated properties. */ -export function withComponentRef(ref: ComponentRef) { - const setInput = (key: K, value: T[K]) => { - ref.setInput(key, value); - return { setInput }; - }; - - return { setInput }; +export function setComponentRefInput( + ref: ComponentRef, + key: K, + value: T[K] +): void { + ref.setInput(key, value); }