diff --git a/.eslintignore b/.eslintignore index 191ae4cc..cd4efd8e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -*.d.ts \ No newline at end of file +*.d.ts diff --git a/lib/Logger.d.ts b/lib/Logger.d.ts index 3f01c385..5c7e4d54 100644 --- a/lib/Logger.d.ts +++ b/lib/Logger.d.ts @@ -6,7 +6,7 @@ declare type LogData = { /** * Register the logging callback * - * @param {Function} callback + * @param callback */ declare function registerLogger(callback: (data: LogData) => void): void; diff --git a/lib/Onyx.d.ts b/lib/Onyx.d.ts index 315dd77d..5f011cdb 100644 --- a/lib/Onyx.d.ts +++ b/lib/Onyx.d.ts @@ -3,6 +3,7 @@ import * as Logger from './Logger'; type ValueOf = T[U]; type MergeBy = Omit & K; +type DeepRecord = {[key: string]: T | DeepRecord}; type TypeOptions = MergeBy< { @@ -23,10 +24,10 @@ declare type ConnectOptions = { 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 = { @@ -40,7 +41,7 @@ declare type UpdateOperations = { }; declare type InitOptions = { - keys?: Record; + keys?: DeepRecord; initialKeyStates?: Partial; safeEvictionKeys?: Key[]; maxCachedKeysCount?: number; @@ -130,7 +131,7 @@ declare function disconnect(connectionID: number, keyToRemoveFrom * @param key ONYXKEY to set * @param value value to store */ -declare function set(key: K, value: Value[K]): Promise; +declare function set(key: K, value: Value[K] | null): Promise; /** * Sets multiple keys and values