From 336b8c7c3e28db8fc3c2422bd05a33b166a897e6 Mon Sep 17 00:00:00 2001 From: Convly Date: Thu, 21 Dec 2023 10:41:54 +0100 Subject: [PATCH] enhancement: allow to configure AttributeUtils.GetValue guard --- .../src/modules/entity-service/params/attributes/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/types/src/modules/entity-service/params/attributes/index.ts b/packages/core/types/src/modules/entity-service/params/attributes/index.ts index 970fd9d28e..28cba45620 100644 --- a/packages/core/types/src/modules/entity-service/params/attributes/index.ts +++ b/packages/core/types/src/modules/entity-service/params/attributes/index.ts @@ -53,7 +53,10 @@ export type GetValues = { * * Fallback to unknown if never is found */ -export type GetValue = Utils.Expression.If< +export type GetValue< + TAttribute extends Attribute.Attribute, + TGuard = unknown +> = Utils.Expression.If< Utils.Expression.IsNotNever, Utils.Expression.MatchFirst< [ @@ -112,7 +115,7 @@ export type GetValue = Utils.Expression. ], // Fallback // If none of the above attribute type, fallback to the original Attribute.GetValue (while making sure it's an attribute) - [Utils.Expression.True, Attribute.GetValue] + [Utils.Expression.True, Attribute.GetValue] ], unknown >,