Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioh8010 committed Jul 3, 2023
1 parent d250efd commit b95c8ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.d.ts
*.d.ts
2 changes: 1 addition & 1 deletion lib/Logger.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare type LogData = {
/**
* Register the logging callback
*
* @param {Function} callback
* @param callback
*/
declare function registerLogger(callback: (data: LogData) => void): void;

Expand Down
9 changes: 5 additions & 4 deletions lib/Onyx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Logger from './Logger';

type ValueOf<T, U extends keyof T = keyof T> = T[U];
type MergeBy<T, K> = Omit<T, keyof K> & K;
type DeepRecord<K extends string | number | symbol, T> = {[key: string]: T | DeepRecord<K, T>};

type TypeOptions = MergeBy<
{
Expand All @@ -23,10 +24,10 @@ declare type ConnectOptions<K extends Key> = {
key: K;
statePropertyName?: string;
withOnyxInstance?: any; // TODO: Type this.
callback?: (value: Value[K] | undefined) => void;
callback?: (value: Value[K] | null) => void;
initWithStoredValues?: boolean;
waitForCollectionCallback?: boolean;
selector?: (value: Value[K] | undefined) => Value[K] | undefined; // TODO: add option for `string` selector.
selector?: (value: Value[K] | null) => Value[K] | null; // TODO: add option for `string` selector.
};

declare type UpdateOperation<K extends Key> = {
Expand All @@ -40,7 +41,7 @@ declare type UpdateOperations<KList extends Key[]> = {
};

declare type InitOptions = {
keys?: Record<string, unknown>;
keys?: DeepRecord<string, string>;
initialKeyStates?: Partial<KeyValueMap>;
safeEvictionKeys?: Key[];
maxCachedKeysCount?: number;
Expand Down Expand Up @@ -130,7 +131,7 @@ declare function disconnect<K extends Key>(connectionID: number, keyToRemoveFrom
* @param key ONYXKEY to set
* @param value value to store
*/
declare function set<K extends Key>(key: K, value: Value[K]): Promise<void>;
declare function set<K extends Key>(key: K, value: Value[K] | null): Promise<void>;

/**
* Sets multiple keys and values
Expand Down

0 comments on commit b95c8ec

Please sign in to comment.