///
declare type MockableFunction = (...args: any[]) => any;
declare type MethodKeysOf = {
[K in keyof T]: T[K] extends MockableFunction ? K : never;
}[keyof T];
declare type PropertyKeysOf = {
[K in keyof T]: T[K] extends MockableFunction ? never : K;
}[keyof T];
declare type ArgumentsOf = T extends (...args: infer A) => any ? A : never;
declare type ConstructorArgumentsOf = T extends new (...args: infer A) => any ? A : never;
interface MockWithArgs extends jest.MockInstance, ArgumentsOf> {
new (...args: ConstructorArgumentsOf): T;
(...args: ArgumentsOf): ReturnType;
}
declare type MaybeMockedConstructor = T extends new (...args: any[]) => infer R ? jest.MockInstance> : {};
declare type MockedFunction = MockWithArgs & {
[K in keyof T]: T[K];
};
declare type MockedFunctionDeep = MockWithArgs & MockedObjectDeep;
declare type MockedObject = MaybeMockedConstructor & {
[K in MethodKeysOf]: T[K] extends MockableFunction ? MockedFunction : T[K];
} & {
[K in PropertyKeysOf]: T[K];
};
declare type MockedObjectDeep = MaybeMockedConstructor & {
[K in MethodKeysOf]: T[K] extends MockableFunction ? MockedFunctionDeep : T[K];
} & {
[K in PropertyKeysOf]: MaybeMockedDeep;
};
export declare type MaybeMockedDeep = T extends MockableFunction ? MockedFunctionDeep : T extends object ? MockedObjectDeep : T;
export declare type MaybeMocked = T extends MockableFunction ? MockedFunction : T extends object ? MockedObject : T;
export declare function mocked(item: T, deep?: false): MaybeMocked;
export declare function mocked(item: T, deep: true): MaybeMockedDeep;
export {};