import { Stdout } from '../ui.js'; import { ReactElement } from 'react'; import { EventEmitter } from 'events'; declare class Stderr extends EventEmitter { readonly frames: string[]; private _lastFrame?; write: (frame: string) => void; lastFrame: () => string | undefined; } export declare class Stdin extends EventEmitter { isTTY: boolean; data: string | null; constructor(options?: { isTTY?: boolean; }); write: (data: string) => void; setEncoding(): void; setRawMode(): void; ref(): void; unref(): void; read: () => string | null; } interface Instance { rerender: (tree: ReactElement) => void; unmount: () => void; cleanup: () => void; stdout: Stdout; stderr: Stderr; stdin: Stdin; frames: string[]; lastFrame: () => string | undefined; waitUntilExit: () => TrackedPromise; } interface RenderOptions { stdout?: EventEmitter; stderr?: EventEmitter; stdin?: EventEmitter; } export declare const render: (tree: ReactElement, options?: RenderOptions) => Instance; /** * Wait for the component to be ready to accept input. */ export declare function waitForInputsToBeReady(): Promise; /** * Wait for the last frame to change to anything. */ export declare function waitForChange(func: () => void, getChangingValue: () => string | number | undefined): Promise; export declare function waitFor(func: () => void, condition: () => boolean): Promise; /** * Wait for the last frame to contain specific text. */ export declare function waitForContent(renderInstance: ReturnType, content: string, func?: () => void): Promise; /** * Send input and wait for the last frame to change. * * Useful when you want to send some input and wait for anything to change in the interface. * If you need to wait for a specific change instead, you can use sendInputAndWaitForContent. */ export declare function sendInputAndWaitForChange(renderInstance: ReturnType, ...inputs: string[]): Promise; /** Send input and wait a number of milliseconds. * * Useful if you know some what will happen after input will take a certain amount of time * and it will not cause any visible change so you can't use sendInputAndWaitForChange. * This function can also be used if you want to test that nothing changes after some input has been sent. */ export declare function sendInputAndWait(renderInstance: ReturnType, waitTime: number, ...inputs: string[]): Promise; /** * Send input and wait for the last frame to contain specific text. * * Useful when you want to send some input and wait for a specific change to happen. * If you need to wait for any change instead, you can use sendInputAndWaitForChange. */ export declare function sendInputAndWaitForContent(renderInstance: ReturnType, content: string, ...inputs: string[]): Promise; /** Function that is useful when you want to check the last frame of a component that unmounted. * * With Ink 6 / React 19, the output is no longer cleared on unmount, * so lastFrame() consistently returns the last rendered content. */ export declare function getLastFrameAfterUnmount(renderInstance: ReturnType): string | undefined; type TrackedPromise = Promise & { isFulfilled: () => boolean; isPending: () => boolean; isRejected: () => boolean; }; export {};