declare let spies: Set>; declare type ReturnError = ['error', any]; declare type ReturnOk = ['ok', R]; declare type ResultFn = ReturnError | ReturnOk; interface Spy { called: boolean; callCount: number; calls: A[]; length: number; results: ResultFn[]; returns: R[]; nextError(error: any): this; nextResult(result: R): this; reset(): void; impl: ((...args: A) => R) | undefined; next: ResultFn | null; } interface SpyImpl extends Spy { getOriginal(): (...args: A) => R; willCall(cb: (...args: A) => R): this; restore(): void; } interface SpyFn extends Spy { (...args: A): R; } declare function spy(cb?: (...args: A) => R): SpyFn; declare type Procedure = (...args: any[]) => any; declare type Methods = { [K in keyof T]: T[K] extends Procedure ? K : never; }[keyof T]; declare type Getters = { [K in keyof T]: T[K] extends Procedure ? never : K; }[keyof T]; declare type Classes = { [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never; }[keyof T]; declare function spyOn>>(obj: T, methodName: { setter: S; }, mock?: (arg: T[S]) => void): SpyImpl<[T[S]], void>; declare function spyOn>>(obj: T, methodName: { getter: G; }, mock?: () => T[G]): SpyImpl<[], T[G]>; declare function spyOn>>(object: T, method: M): Required[M] extends new (...args: infer A) => infer R ? SpyImpl : never; declare function spyOn>>(obj: T, methodName: M, mock?: T[M]): Required[M] extends (...args: infer A) => infer R ? SpyImpl : never; declare function restoreAll(): void; export { Spy, SpyFn, SpyImpl, restoreAll, spies, spy, spyOn };