Skip to content

Instantly share code, notes, and snippets.

@DarkRoku12
Created December 25, 2023 02:06
Show Gist options
  • Save DarkRoku12/0935ef9062878d67e444a3497cbba826 to your computer and use it in GitHub Desktop.
Save DarkRoku12/0935ef9062878d67e444a3497cbba826 to your computer and use it in GitHub Desktop.
React constants for custom hook.
/** Created by DarkRoku12 */
export const SymbolAddWatcher = Symbol("__addWatcher");
export const SymbolForAll = Symbol("__forAll");
export type RecordIndex = string | number | symbol;
export type AnyRecord = Record<RecordIndex, any>;
export type RecordObj<T extends AnyRecord> = T & AnyRecord;
// eslint-disable-next-line @typescript-eslint/ban-types
export type Watched<T extends AnyRecord> = RecordObj<T> & { [SymbolAddWatcher]: Function };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment