///
declare type EventListener = (obj: any) => void;
declare type ErrorListener = (err: any) => void;
declare type ExitListener = (code: number | null) => void;
declare type CloseListener = (code: number | null, signal: NodeJS.Signals | null) => void;
export interface Server {
/** Returns the response (or event) with the matching `request_seq`. */
message(request: any): Promise;
/**
* Sends an exit message to the server and forcibly kills it if it hasn't exited after `timeoutMs`.
* Throws if the request fails (e.g. if the server has already exited).
* Throws if the server doesn't exit before `timeoutMs` and it cannot be killed.
* Returns true if the server exited before `timeoutMs` and false if it was killed.
*/
exitOrKill(timoutMs: number): Promise;
/** Kills the server, regardless of its current state. */
kill(): Promise;
/** Fires when an event is received from the server. */
on(event: "event", listener: EventListener): void;
/** Fires when an internal error occurs in the harness (not for language service errors). */
on(event: "communicationError", listener: ErrorListener): void;
/** Fires when the server exits. */
on(event: "exit", listener: ExitListener): void;
/** Fires when the server closes (exits + closes IO streams). */
on(event: "close", listener: CloseListener): void;
/** The PID of the subprocess. */
pid?: number;
}
/**
* Forks a new server process. By default, the server will not have ATA or produce diagnostic events.
*/
export declare function launchServer(tsserverPath: string, args?: string[], execArgv?: string[], env?: NodeJS.ProcessEnv): Server;
export {};