/**
 * These are types for things that are present in the React `canary` release channel.
 *
 * To load the types declared here in an actual project, there are three ways. The easiest one,
 * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
 * is to add `"react/canary"` to the `"types"` array.
 *
 * Alternatively, a specific import syntax can to be used from a typescript file.
 * This module does not exist in reality, which is why the {} is important:
 *
 * ```ts
 * import {} from 'react/canary'
 * ```
 *
 * It is also possible to include it through a triple-slash reference:
 *
 * ```ts
 * /// <reference types="react/canary" />
 * ```
 *
 * Either the import or the reference only needs to appear once, anywhere in the project.
 */

// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,

import React = require(".");

export {};

declare const UNDEFINED_VOID_ONLY: unique symbol;
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };

declare module "." {
    export function unstable_useCacheRefresh(): () => void;

    export interface CacheSignal {}
    export function cacheSignal(): null | CacheSignal;

    // @enableActivity
    export interface ActivityProps {
        /**
         * @default "visible"
         */
        mode?:
            | "hidden"
            | "visible"
            | undefined;
        /**
         * A name for this Activity boundary for instrumentation purposes.
         * The name will help identify this boundary in React DevTools.
         */
        name?: string | undefined;
        children: ReactNode;
    }

    /**
     * @see {@link https://react.dev/reference/react/Activity `<Activity>` documentation}
     */
    export const Activity: ExoticComponent<ActivityProps>;

    /**
     * @see {@link https://react.dev/reference/react/useEffectEvent `useEffectEvent()` documentation}
     */
    // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
    export function useEffectEvent<T extends Function>(callback: T): T;
}
