// Type declarations for react-server-dom-webpack // Based on Flow types from React source declare module "react-server-dom-webpack/server" { import type { Thenable, ReactNode } from "react"; export type TemporaryReferenceSet = Set; export type ClientManifest = { [moduleId: string]: { id: string; chunks: string[]; name: string; }; }; export type ServerManifest = { [id: string]: { id: string; chunks: string[]; name: string; }; }; export type RenderOptions = { debugChannel?: { readable?: ReadableStream; writable?: WritableStream }; environmentName?: string | (() => string); filterStackFrame?: (url: string, functionName: string) => boolean; identifierPrefix?: string; signal?: AbortSignal; temporaryReferences?: TemporaryReferenceSet; onError?: (error: unknown) => void; }; export type StaticResult = { prelude: ReadableStream; }; export function renderToReadableStream( model: ReactNode, webpackMap: ClientManifest, options?: RenderOptions, ): ReadableStream; export function prerender( model: ReactNode, webpackMap: ClientManifest, options?: RenderOptions, ): Promise; export function decodeReply( body: string | FormData, webpackMap: ServerManifest, options?: { temporaryReferences?: TemporaryReferenceSet }, ): Thenable; export function decodeAction( body: FormData, serverManifest: ServerManifest, ): Promise<() => T> | null; export function decodeFormState( actionResult: S, body: FormData, serverManifest: ServerManifest, ): Promise; export function registerServerReference( reference: T, id: string, exportName: string | null, ): T; export function registerClientReference( proxyImplementation: T, id: string, exportName: string, ): T; export function createClientModuleProxy>(moduleId: string): T; export function createTemporaryReferenceSet(): TemporaryReferenceSet; } declare module "react-server-dom-webpack/client" { import type { Thenable } from "react"; export type TemporaryReferenceSet = Set; export type CallServerCallback = (id: string, args: unknown[]) => Promise; export type FindSourceMapURLCallback = ( fileName: string, environmentName: string, ) => string | null | undefined; export type Options = { callServer?: CallServerCallback; debugChannel?: { writable?: WritableStream; readable?: ReadableStream }; temporaryReferences?: TemporaryReferenceSet; findSourceMapURL?: FindSourceMapURLCallback; replayConsoleLogs?: boolean; environmentName?: string; startTime?: number; endTime?: number; }; export function createFromReadableStream( stream: ReadableStream, options?: Options, ): Thenable; export function createFromFetch( promiseForResponse: Promise, options?: Options, ): Thenable; export function encodeReply( value: unknown, options?: { temporaryReferences?: TemporaryReferenceSet; signal?: AbortSignal }, ): Promise; export function createServerReference( id: string, callServer: CallServerCallback, ): T; export function registerServerReference( reference: T, id: string, exportName: string | null, ): T; export function createTemporaryReferenceSet(): TemporaryReferenceSet; }