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.
@@ -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: Stub<T>): T;
4
+ export declare function stub<T>(stub?: Stub<T>): T;
@@ -1 +1 @@
1
- {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":";;;AAKA,SAAgB,IAAI,CAAI,IAAa;IACnC,OAAO,IAAS,CAAA;AAClB,CAAC;AAFD,oBAEC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,IAAI,CAAI,IAAa;IACnC,OAAO,IAAS,CAAA;AAClB,CAAC"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-plus",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "Provides additional types for TypeScript.",
5
5
  "homepage": "https://github.com/unional/type-plus",
6
6
  "bugs": {
@@ -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
+ })
@@ -3,6 +3,6 @@ import { RecursivePartial } from '../object'
3
3
 
4
4
  export type Stub<T> = T extends AnyFunction ? T : RecursivePartial<T>
5
5
 
6
- export function stub<T>(stub: Stub<T>) {
6
+ export function stub<T>(stub?: Stub<T>) {
7
7
  return stub as T
8
8
  }