From 933a5d1f36dde1e3a691b016a0d7b3ee4d6d36d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Mon, 24 Jun 2024 16:21:56 +0100 Subject: [PATCH] Improve CachedValue type readability --- lib/useOnyx.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/useOnyx.ts b/lib/useOnyx.ts index ffbcdc80..e523eaff 100644 --- a/lib/useOnyx.ts +++ b/lib/useOnyx.ts @@ -46,7 +46,9 @@ type UseOnyxOptions = BaseUseOnyxOptions & U type FetchStatus = 'loading' | 'loaded'; -type CachedValue = IsEqual> extends true ? TValue : TKey extends CollectionKeyBase ? OnyxCollection : OnyxEntry; +type SelectedValue = TKey extends CollectionKeyBase ? OnyxCollection : OnyxEntry; + +type CachedValue = IsEqual> extends true ? TValue : SelectedValue; type ResultMetadata = { status: FetchStatus;