mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 17:51:46 +00:00
use any instead of {} for mock return type
This commit is contained in:
Vendored
+2
-2
@@ -763,12 +763,12 @@ declare namespace jest {
|
||||
new (...args: any[]): any;
|
||||
}
|
||||
|
||||
interface Mock<T = {}, Y extends any[] = any> extends Function, MockInstance<T, Y> {
|
||||
interface Mock<T = any, Y extends any[] = any> extends Function, MockInstance<T, Y> {
|
||||
new (...args: Y): T;
|
||||
(...args: Y): T;
|
||||
}
|
||||
|
||||
interface SpyInstance<T = {}, Y extends any[] = any> extends MockInstance<T, Y> {}
|
||||
interface SpyInstance<T = any, Y extends any[] = any> extends MockInstance<T, Y> {}
|
||||
|
||||
/**
|
||||
* Wrap module with mock definitions
|
||||
|
||||
@@ -305,6 +305,9 @@ jest.fn().mockRestore();
|
||||
|
||||
const spiedTarget = {
|
||||
returnsVoid(): void { },
|
||||
setValue(value: string): void {
|
||||
this.value = value;
|
||||
},
|
||||
returnsString(): string {
|
||||
return "";
|
||||
}
|
||||
@@ -361,6 +364,9 @@ spy5.mockReturnValue('5');
|
||||
// $ExpectType SpyInstance<void, [number]>
|
||||
const spy6 = jest.spyOn(spiedTarget2, "value", "set");
|
||||
|
||||
let spy7: jest.SpyInstance;
|
||||
spy7 = jest.spyOn(spiedTarget, "setValue");
|
||||
|
||||
/* Snapshot serialization */
|
||||
|
||||
const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = {
|
||||
|
||||
Reference in New Issue
Block a user