type-plus 4.0.1 → 4.0.2

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,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,iDAA8B;AAE9B,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,iDAA8B;AAE9B,gDAA6B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/assertion/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/assertion/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,kDAA+B"}
package/cjs/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mCAAmC;AACnC,uCAAkD;AAAzC,qGAAA,QAAQ,OAAA;AAAE,yGAAA,YAAY,OAAA;AAC/B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AAEvB,6CAA0B;AAC1B,+CAA4B;AAC5B,8CAA2B;AAC3B,yCAAsB;AACtB,2CAAwB;AACxB,kDAA+B;AAC/B,2CAAwB;AACxB,+CAA4B;AAE5B,4CAAyB;AAIzB,0CAAuB;AACvB,+BAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,uCAAkD;AAAzC,qGAAA,QAAQ,OAAA;AAAE,yGAAA,YAAY,OAAA;AAC/B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AAEvB,6CAA0B;AAC1B,+CAA4B;AAC5B,8CAA2B;AAC3B,yCAAsB;AACtB,2CAAwB;AACxB,kDAA+B;AAC/B,2CAAwB;AACxB,+CAA4B;AAE5B,4CAAyB;AAIzB,0CAAuB;AACvB,+BAA+B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/nodejs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/nodejs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/nominal-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAuB;AACvB,2CAAwB;AACxB,iDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/nominal-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,2CAAwB;AACxB,iDAA8B"}
@@ -19,7 +19,7 @@ export * from './mapKey';
19
19
  export * from './mapProperties';
20
20
  export * from './omit';
21
21
  export type { OptionalKeys } from './OptionalKeys';
22
- export type { PartialOmit, PartialPick } from './Partial';
22
+ export type { PartialOmit, PartialPick, PartialExcept } from './Partial';
23
23
  export * from './pick';
24
24
  export type { RecursiveIntersect } from './RecursiveIntersect';
25
25
  export type { RecursivePartial } from './RecursivePartial';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/object/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAA0B;AAE1B,2CAAwB;AACxB,8CAA2B;AAC3B,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,2CAAwB;AACxB,gDAA6B;AAO7B,2CAAwB;AACxB,kDAA+B;AAC/B,yCAAsB;AAGtB,yCAAsB;AAItB,8CAA2B;AAC3B,oDAAiC;AAGjC,4CAAyB;AAEzB,6DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/object/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,6CAA0B;AAE1B,2CAAwB;AACxB,8CAA2B;AAC3B,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,2CAAwB;AACxB,gDAA6B;AAO7B,2CAAwB;AACxB,kDAA+B;AAC/B,yCAAsB;AAGtB,yCAAsB;AAItB,8CAA2B;AAC3B,oDAAiC;AAGjC,4CAAyB;AAEzB,6DAA0C"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/predicates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAI3B,2CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/predicates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAI3B,2CAAwB"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/promise/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B;AAG3B,8CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/promise/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAG3B,8CAA2B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-plus",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Provides additional types for `typescript`.",
5
5
  "homepage": "https://github.com/unional/type-plus",
6
6
  "bugs": {
@@ -40,7 +40,8 @@
40
40
  "release": "npx semantic-release",
41
41
  "size-limit": "size-limit",
42
42
  "test": "jest",
43
- "verify": "run-p verify:build lint coverage",
43
+ "test:types": "tsc",
44
+ "verify": "run-p verify:build lint test:types coverage",
44
45
  "verify:build": "npm-run-all clean build --parallel dependency-check size-limit",
45
46
  "watch": "jest --watch"
46
47
  },
@@ -50,39 +51,39 @@
50
51
  }
51
52
  },
52
53
  "dependencies": {
53
- "tersify": "^3.8.0",
54
+ "tersify": "^3.8.2",
54
55
  "unpartial": "^0.6.4"
55
56
  },
56
57
  "devDependencies": {
57
- "@babel/core": "^7.16.7",
58
+ "@babel/core": "^7.17.7",
58
59
  "@babel/plugin-proposal-class-properties": "^7.16.7",
59
60
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
60
61
  "@babel/plugin-proposal-optional-chaining": "^7.16.7",
61
- "@babel/preset-env": "^7.16.7",
62
+ "@babel/preset-env": "^7.16.11",
62
63
  "@babel/preset-typescript": "^7.16.7",
63
- "@commitlint/cli": "^16.0.1",
64
- "@commitlint/config-conventional": "^16.0.0",
64
+ "@commitlint/cli": "^16.2.3",
65
+ "@commitlint/config-conventional": "^16.2.1",
65
66
  "@semantic-release/changelog": "^6.0.1",
66
- "@size-limit/preset-small-lib": "^7.0.5",
67
- "@types/jest": "^27.4.0",
68
- "@unional/fixture": "^1.7.2",
69
- "assertron": "^9.0.0",
67
+ "@size-limit/preset-small-lib": "^7.0.8",
68
+ "@types/jest": "^27.4.1",
69
+ "@unional/fixture": "^1.8.0",
70
+ "assertron": "^9.0.4",
70
71
  "dependency-check": "^4.1.0",
71
- "eslint": "^8.6.0",
72
+ "eslint": "^8.11.0",
72
73
  "eslint-plugin-harmony": "^6.0.0",
73
74
  "husky": "^7.0.4",
74
- "jest": "^27.4.5",
75
- "jest-progress-tracker": "^3.0.1",
76
- "jest-validate": "^27.4.2",
75
+ "jest": "^27.5.1",
76
+ "jest-progress-tracker": "^3.0.3",
77
+ "jest-validate": "^27.5.1",
77
78
  "jest-watch-repeat": "^2.0.0",
78
79
  "jest-watch-suspend": "^1.1.2",
79
80
  "jest-watch-toggle-config": "^2.0.1",
80
81
  "jest-watch-typeahead": "^1.0.0",
81
82
  "npm-run-all": "^4.1.5",
82
83
  "rimraf": "^3.0.2",
83
- "satisfier": "^5.1.1",
84
- "size-limit": "^7.0.5",
85
- "typescript": "^4.5.4"
84
+ "satisfier": "^5.1.2",
85
+ "size-limit": "^7.0.8",
86
+ "typescript": "^4.6.2"
86
87
  },
87
88
  "size-limit": [
88
89
  {
package/ts/index.spec.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { T, types } from '.'
1
+ // import { T, types } from '.'
2
2
 
3
- test('export types also as T', () => {
4
- expect(T).toBe(types)
5
- })
3
+ // test('export types also as T', () => {
4
+ // expect(T).toBe(types)
5
+ // })
6
+
7
+ test.todo('no test')
@@ -1,49 +1,49 @@
1
- import { assertType, PartialExcept, PartialOmit, PartialPick } from '..'
2
-
3
- test('work on primitive type', () => {
4
- type Foo = PartialPick<number, 'toFixed'>
5
- const x: Foo = 1
6
- assertType<typeof x['toFixed']>(1 as unknown as 1['toFixed'] | undefined)
7
- })
8
-
9
- test('make picked properties optional', () => {
10
- type Foo = {
11
- a: number,
12
- b: number,
13
- c: number,
14
- }
15
-
16
- const y: PartialPick<Foo, 'a'> = { b: 1, c: 2 }
17
-
18
- y.a = undefined
19
- assertType.noUndefined(y.b)
20
- assertType.noUndefined(y.c)
21
- })
22
-
23
- test('make not specified properties optional', () => {
24
- type Foo = {
25
- a: number,
26
- b: number,
27
- c: number,
28
- }
29
-
30
- const y: PartialExcept<Foo, 'a'> = { a: 1 }
31
- assertType.noUndefined(y.a)
32
- y.b = undefined
33
- y.c = undefined
34
- })
35
-
36
-
37
- test('make not specified properties optional', () => {
38
- type Foo = {
39
- a: number,
40
- b: number,
41
- c: number,
42
- }
43
-
44
- const y: PartialOmit<Foo, 'a'> = { a: 1 }
45
-
46
- assertType.noUndefined(y.a)
47
- y.b = undefined
48
- y.c = undefined
49
- })
1
+ import { assertType, PartialExcept, PartialOmit, PartialPick } from '..'
2
+
3
+ test('work on primitive type', () => {
4
+ type Foo = PartialPick<number, 'toFixed'>
5
+ const x: Foo = 1
6
+ assertType<typeof x['toFixed']>(1 as unknown as 1['toFixed'] | undefined)
7
+ })
8
+
9
+ test('make picked properties optional', () => {
10
+ type Foo = {
11
+ a: number,
12
+ b: number,
13
+ c: number,
14
+ }
15
+
16
+ const y: PartialPick<Foo, 'a'> = { b: 1, c: 2 }
17
+
18
+ y.a = undefined
19
+ assertType.noUndefined(y.b)
20
+ assertType.noUndefined(y.c)
21
+ })
22
+
23
+ test('make not specified properties optional', () => {
24
+ type Foo = {
25
+ a: number,
26
+ b: number,
27
+ c: number,
28
+ }
29
+
30
+ const y: PartialExcept<Foo, 'a'> = { a: 1 }
31
+ assertType.noUndefined(y.a)
32
+ y.b = undefined
33
+ y.c = undefined
34
+ })
35
+
36
+
37
+ test('make not specified properties optional', () => {
38
+ type Foo = {
39
+ a: number,
40
+ b: number,
41
+ c: number,
42
+ }
43
+
44
+ const y: PartialOmit<Foo, 'a'> = { a: 1 }
45
+
46
+ assertType.noUndefined(y.a)
47
+ y.b = undefined
48
+ y.c = undefined
49
+ })
@@ -19,7 +19,7 @@ export * from './mapKey'
19
19
  export * from './mapProperties'
20
20
  export * from './omit'
21
21
  export type { OptionalKeys } from './OptionalKeys'
22
- export type { PartialOmit, PartialPick } from './Partial'
22
+ export type { PartialOmit, PartialPick, PartialExcept } from './Partial'
23
23
  export * from './pick'
24
24
  export type { RecursiveIntersect } from './RecursiveIntersect'
25
25
  export type { RecursivePartial } from './RecursivePartial'