/// export type ArgumentOrMatcher = { [Index in keyof ArgTypes]: ArgTypes[Index] | WhenMock; }; export interface WhenMock { calledWith(allArgsMatcher: AllArgsMatcher): WhenMockWithMatchers; calledWith(...matchers: ArgumentOrMatcher): WhenMockWithMatchers; expectCalledWith(allArgsMatcher: AllArgsMatcher): WhenMockWithMatchers; expectCalledWith(...matchers: ArgumentOrMatcher): WhenMockWithMatchers; mockReturnValue(value: T): WhenMockWithMatchers & WhenMock; mockResolvedValue(value: jest.ResolvedValue): WhenMockWithMatchers & WhenMock; mockRejectedValue(value: jest.RejectedValue): WhenMockWithMatchers & WhenMock; mockImplementation(fn: (...args: Y) => T): WhenMockWithMatchers & WhenMock; defaultReturnValue(value: T): WhenMockWithMatchers & WhenMock; defaultResolvedValue(value: jest.ResolvedValue): WhenMockWithMatchers & WhenMock; defaultRejectedValue(value: jest.RejectedValue): WhenMockWithMatchers & WhenMock; defaultImplementation(fn: (...args: Y) => T): WhenMockWithMatchers & WhenMock; resetWhenMocks(): void; } export interface WhenMockWithMatchers { mockReturnValue(value: T): WhenMockWithMatchers & WhenMock; mockReturnValueOnce(value: T): WhenMockWithMatchers & WhenMock; mockResolvedValue(value: jest.ResolvedValue): WhenMockWithMatchers & WhenMock; mockResolvedValueOnce(value: jest.ResolvedValue): WhenMockWithMatchers & WhenMock; mockRejectedValue(value: jest.RejectedValue): WhenMockWithMatchers & WhenMock; mockRejectedValueOnce(value: jest.RejectedValue): WhenMockWithMatchers & WhenMock; mockImplementation(fn: (...args: Y) => T): WhenMockWithMatchers & WhenMock; mockImplementationOnce(fn?: (...args: Y) => T): WhenMockWithMatchers & WhenMock; defaultImplementation(fn: (...args: Y) => T): WhenMockWithMatchers & WhenMock; defaultReturnValue(value: T): WhenMockWithMatchers & WhenMock; defaultResolvedValue(value: jest.ResolvedValue): WhenMockWithMatchers & WhenMock; defaultRejectedValue(value: jest.RejectedValue): WhenMockWithMatchers & WhenMock; } export interface AllArgsMatcher { (args: Y, equals: jest.MatcherUtils["equals"]): boolean; // Internal, but needed to distinguish from normal callables _isAllArgsFunctionMatcher: true; _isFunctionMatcher: true; } export interface When { (fn: ((...args: Y) => T) | jest.MockInstance): WhenMock; allArgs(matcher: (args: Y, equals: jest.MatcherUtils["equals"]) => boolean): AllArgsMatcher; } export const when: When; export function resetAllWhenMocks(): void; export function verifyAllWhenMocksCalled(): void;