a 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +8 -3
  2. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  type AnyFunction = (...args: any[]) => any;
2
2
  type Tail<T extends any[]> = T extends [any, ...infer R] ? R : [];
3
+ type MockedFunction<T extends AnyFunction> = MockFunction<
4
+ Parameters<T>,
5
+ ReturnType<T>
6
+ > &
7
+ T;
3
8
 
4
9
  interface RepeatControl {
5
10
  repeat(times: number): RepeatControl;
@@ -40,8 +45,8 @@ interface MockFunction<TArgs extends any[], R> {
40
45
  reset(): void;
41
46
  }
42
47
 
43
- type Mocked<T> = T extends (...args: infer A) => infer R
44
- ? MockFunction<A, R>
48
+ type Mocked<T> = T extends AnyFunction
49
+ ? MockedFunction<T>
45
50
  : T extends object
46
51
  ? { [K in keyof T]: Mocked<T[K]> } & { verify: () => true }
47
52
  : T;
@@ -69,7 +74,7 @@ declare function mock<TArgs extends any[] = any[], R = any>(): MockFunction<
69
74
  >;
70
75
  declare function mock<T extends AnyFunction>(
71
76
  original: T
72
- ): MockFunction<Parameters<T>, ReturnType<T>>;
77
+ ): MockedFunction<T>;
73
78
  declare function mock<T extends object>(subject: T): Mocked<T>;
74
79
 
75
80
  declare function expectRequire(moduleName: string): RequireExpectation;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "a",
3
- "version": "4.0.2",
4
- "main": "index.js",
5
- "types": "index.d.ts",
6
- "title": "a",
3
+ "version": "4.0.3",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "title": "a",
7
7
  "description": "Mocking framework",
8
8
  "keywords": [
9
9
  "mock",