use any instead of {} for mock return type

This commit is contained in:
Antoine Brault
2018-12-11 14:21:36 -05:00
parent 3236add57d
commit fd0775200e
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -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
+6
View File
@@ -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 = {