type-plus 4.4.0 → 4.4.1
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.
package/cjs/testing/stub.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AnyFunction } from '../function';
|
|
2
2
|
import { RecursivePartial } from '../object';
|
|
3
3
|
export declare type Stub<T> = T extends AnyFunction ? T : RecursivePartial<T>;
|
|
4
|
-
export declare function stub<T>(stub
|
|
4
|
+
export declare function stub<T>(stub?: Stub<T>): T;
|
package/cjs/testing/stub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":";;;AAKA,SAAgB,IAAI,CAAI,
|
|
1
|
+
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":";;;AAKA,SAAgB,IAAI,CAAI,IAAc;IACpC,OAAO,IAAS,CAAA;AAClB,CAAC;AAFD,oBAEC"}
|
package/esm/testing/stub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,IAAI,CAAI,
|
|
1
|
+
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,IAAI,CAAI,IAAc;IACpC,OAAO,IAAS,CAAA;AAClB,CAAC"}
|
package/package.json
CHANGED
package/ts/testing/stub.spec.ts
CHANGED
|
@@ -29,3 +29,10 @@ test('stub function params can be omitted', () => {
|
|
|
29
29
|
expect(a('1', 1)).toBe(false)
|
|
30
30
|
isType.equal<true, typeof a, typeof real>()
|
|
31
31
|
})
|
|
32
|
+
|
|
33
|
+
test('stub input can be omitted', () => {
|
|
34
|
+
const real = { a: 1, b: { c: 2 }, d: 3 }
|
|
35
|
+
|
|
36
|
+
const a = stub<typeof real>()
|
|
37
|
+
isType.equal<true, typeof a, typeof real>()
|
|
38
|
+
})
|