Skip to content

Commit

Permalink
Merge branch 'main' into feature/ts-migration/withOnyx
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioh8010 committed May 24, 2024
2 parents dbdb675 + b6a108d commit abbbd76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions lib/useOnyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import Onyx from './Onyx';
type UseOnyxValue<TKey extends OnyxKey> = string extends TKey
? unknown
: TKey extends CollectionKeyBase
? Readonly<NonNull<OnyxCollection<KeyValueMapping[TKey]>>>
: Readonly<NonNull<OnyxEntry<KeyValueMapping[TKey]>>>;
? NonNull<OnyxCollection<KeyValueMapping[TKey]>>
: NonNull<OnyxEntry<KeyValueMapping[TKey]>>;

type BaseUseOnyxOptions = {
/**
Expand Down Expand Up @@ -55,11 +55,7 @@ type UseOnyxOptions<TKey extends OnyxKey, TReturnValue> = BaseUseOnyxOptions & U

type FetchStatus = 'loading' | 'loaded';

type CachedValue<TKey extends OnyxKey, TValue> = IsEqual<TValue, UseOnyxValue<TKey>> extends true
? TValue
: TKey extends CollectionKeyBase
? Readonly<NonNullable<OnyxCollection<TValue>>>
: Readonly<TValue>;
type CachedValue<TKey extends OnyxKey, TValue> = IsEqual<TValue, UseOnyxValue<TKey>> extends true ? TValue : TKey extends CollectionKeyBase ? NonNullable<OnyxCollection<TValue>> : TValue;

type ResultMetadata = {
status: FetchStatus;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-onyx",
"version": "2.0.40",
"version": "2.0.41",
"author": "Expensify, Inc.",
"homepage": "https://expensify.com",
"description": "State management for React Native",
Expand Down

0 comments on commit abbbd76

Please sign in to comment.