import type { ChildProcessWrapper } from './child-wrapper';
export type WorkerStatus = WorkerState['status'];
export type WorkerState = {
    status: 'errored';
    thrown: unknown;
} | {
    status: 'dead';
    murdered: boolean;
} | {
    status: 'killing';
} | {
    status: 'reloading';
} | {
    status: 'live';
    child: ChildProcessWrapper;
};
export type StateOf<S extends WorkerStatus> = Extract<WorkerState, {
    status: S;
}>;
export type WorkerStateHandler<S extends WorkerStatus> = (state: StateOf<S>) => void;
export declare class WorkerStateObserver {
    private _state;
    private _handlers;
    constructor(initialState: WorkerState);
    waitFor<S extends WorkerStatus>(status: S): Promise<void>;
    on<S extends WorkerStatus>(status: S, handler: WorkerStateHandler<S>): void;
    off<S extends WorkerStatus>(status: S, handler: WorkerStateHandler<S>): void;
    get(): WorkerState;
    set(newState: WorkerState): void;
}
