import { Component } from 'react'; import type { ReactNode } from 'react'; declare global { interface ImportMeta { readonly env: Record; } } type Elements = Record; type SetElements = (updater: (prev: Promise) => Promise) => void; type EnhanceFetch = (fetchFn: typeof fetch) => typeof fetch; type EnhanceCreateData = (createData: (responsePromise: Promise) => Promise) => (responsePromise: Promise) => Promise; declare const ENTRY = "e"; declare const SET_ELEMENTS = "s"; declare const ENHANCE_FETCH = "f"; declare const ENHANCE_CREATE_DATA = "d"; type FetchCache = { [ENTRY]?: [ rscPath: string, rscParams: unknown, elementsPromise: Promise ]; [SET_ELEMENTS]?: SetElements; [ENHANCE_FETCH]?: EnhanceFetch | undefined; [ENHANCE_CREATE_DATA]?: EnhanceCreateData | undefined; }; /** * callServer callback * This is not a public API. */ export declare const unstable_callServerRsc: (funcId: string, args: unknown[], fetchCache?: FetchCache) => Promise; export declare const fetchRsc: (rscPath: string, rscParams?: unknown, fetchCache?: FetchCache) => Promise; export declare const prefetchRsc: (rscPath: string, rscParams?: unknown, fetchCache?: FetchCache) => void; export declare const Root: ({ initialRscPath, initialRscParams, fetchCache, unstable_enhanceFetch, unstable_enhanceCreateData, children, }: { initialRscPath?: string; initialRscParams?: unknown; fetchCache?: FetchCache; unstable_enhanceFetch?: EnhanceFetch; unstable_enhanceCreateData?: EnhanceCreateData; children: ReactNode; }) => import("react").FunctionComponentElement void>>; export declare const useRefetch: () => (rscPath: string, rscParams?: unknown) => void; export declare const Children: () => ReactNode; export declare const ThrowError_UNSTABLE: () => null; export declare const useResetError_UNSTABLE: () => (() => void) | undefined; export declare const useElement: (id: string) => unknown; declare class GeneralErrorHandler extends Component<{ children?: ReactNode; errorHandler: ReactNode; }, { error: unknown | null; }> { constructor(props: { children?: ReactNode; errorHandler: ReactNode; }); static getDerivedStateFromError(error: unknown): { error: unknown; }; reset(): void; render(): string | number | bigint | boolean | import("react").ReactElement> | Iterable | Promise> | Iterable | null | undefined> | import("react").FunctionComponentElement void] | undefined>> | null | undefined; } /** * Slot component * This is used under the Root component. * Slot id is the key of elements returned by the server. * * If the server returns this * ``` * { 'foo':
foo
, 'bar':
bar
} * ``` * then you can use this component like this * ``` * * ``` */ export declare const Slot: ({ id, children, unstable_handleError, unstable_fallback, }: { id: string; children?: ReactNode; unstable_handleError?: ReactNode; unstable_fallback?: ReactNode; }) => import("react").FunctionComponentElement<{ id: string; children?: ReactNode; setValidElement?: (element: ReactNode) => void; unstable_fallback?: ReactNode; }> | import("react").CElement<{ children?: ReactNode; errorHandler: ReactNode; }, GeneralErrorHandler>; /** * ServerRoot for SSR * This is not a public API. */ export declare const INTERNAL_ServerRoot: ({ elementsPromise, children, }: { elementsPromise: Promise; children: ReactNode; }) => import("react").FunctionComponentElement | null>>; export {};