/** * These are types for things that are present in the React `next` 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/next"` 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/next' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// * ``` * * 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 module '.' { interface ThenableImpl { then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike; } interface UntrackedThenable extends ThenableImpl { status?: void; } export interface PendingThenable extends ThenableImpl { status: 'pending'; } export interface FulfilledThenable extends ThenableImpl { status: 'fulfilled'; value: T; } export interface RejectedThenable extends ThenableImpl { status: 'rejected'; reason: unknown; } export type Thenable = UntrackedThenable | PendingThenable | FulfilledThenable | RejectedThenable; export type Usable = Thenable | Context; export function use(usable: Usable): T; interface ServerContextJSONArray extends ReadonlyArray {} export type ServerContextJSONValue = | string | boolean | number | null | ServerContextJSONArray | { [key: string]: ServerContextJSONValue }; export interface ServerContext { Provider: Provider; } /** * Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current * context value, as given by the nearest context provider for the given context. * * @version 16.8.0 * @see https://react.dev/reference/react/useContext */ function useContext(context: ServerContext): T; export function createServerContext( globalName: string, defaultValue: T, ): ServerContext; // tslint:disable-next-line ban-types export function cache(fn: CachedFunction): CachedFunction; export function unstable_useCacheRefresh(): () => void; }