diff --git a/src/stubs.ts b/src/stubs.ts index 004c755..ea0186b 100644 --- a/src/stubs.ts +++ b/src/stubs.ts @@ -64,8 +64,7 @@ export const configureStub = ( export const validateSpy = (maybeSpy: unknown): MockInstance => { if ( - maybeSpy && - (typeof maybeSpy === 'function' || typeof maybeSpy === 'object') && + typeof maybeSpy === 'function' && 'mockImplementation' in maybeSpy && typeof maybeSpy.mockImplementation === 'function' && 'getMockImplementation' in maybeSpy && @@ -73,7 +72,7 @@ export const validateSpy = (maybeSpy: unknown): MockInstance => { 'getMockName' in maybeSpy && typeof maybeSpy.getMockName === 'function' ) { - return maybeSpy as MockInstance + return maybeSpy as unknown as MockInstance } throw new NotAMockFunctionError(maybeSpy)