@augment-vir/core 32.1.0 → 32.2.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/dist/augments/error/ensure-error.d.ts +1 -1
- package/dist/augments/json/json-compatible.d.ts +2 -1
- package/dist/augments/json/json-value.d.ts +46 -0
- package/dist/augments/json/json-value.js +1 -0
- package/dist/augments/json/jsonify.d.ts +41 -0
- package/dist/augments/json/jsonify.js +1 -0
- package/dist/augments/number/infinity.d.ts +22 -0
- package/dist/augments/number/infinity.js +1 -0
- package/dist/augments/object/object-keys.d.ts +1 -1
- package/dist/augments/object/required-keys.d.ts +5 -5
- package/dist/augments/type/apply-default-options.d.ts +24 -0
- package/dist/augments/type/apply-default-options.js +1 -0
- package/dist/augments/type/built-in-type.d.ts +28 -0
- package/dist/augments/type/built-in-type.js +1 -0
- package/dist/augments/type/conditional-type.d.ts +25 -0
- package/dist/augments/type/conditional-type.js +1 -0
- package/dist/augments/type/constructor-type.d.ts +51 -0
- package/dist/augments/type/constructor-type.js +1 -0
- package/dist/augments/type/distributed-omit.d.ts +13 -0
- package/dist/augments/type/distributed-omit.js +1 -0
- package/dist/augments/type/empty-object.d.ts +27 -0
- package/dist/augments/type/empty-object.js +1 -0
- package/dist/augments/type/exact.d.ts +23 -0
- package/dist/augments/type/exact.js +1 -0
- package/dist/augments/type/except.d.ts +40 -0
- package/dist/augments/type/except.js +1 -0
- package/dist/augments/type/exclude-exactly.d.ts +27 -0
- package/dist/augments/type/exclude-exactly.js +1 -0
- package/dist/augments/type/is-unknown.d.ts +22 -0
- package/dist/augments/type/is-unknown.js +1 -0
- package/dist/augments/type/keys-of-union.d.ts +14 -0
- package/dist/augments/type/keys-of-union.js +1 -0
- package/dist/augments/type/literal-union.d.ts +13 -0
- package/dist/augments/type/literal-union.js +1 -0
- package/dist/augments/type/merge.d.ts +20 -0
- package/dist/augments/type/merge.js +1 -0
- package/dist/augments/type/non-empty-string.d.ts +9 -0
- package/dist/augments/type/non-empty-string.js +1 -0
- package/dist/augments/type/omit-deep.d.ts +373 -0
- package/dist/augments/type/omit-deep.js +1 -0
- package/dist/augments/type/omit-index-signature.d.ts +28 -0
- package/dist/augments/type/omit-index-signature.js +2 -0
- package/dist/augments/type/optional-keys-of.d.ts +25 -0
- package/dist/augments/type/optional-keys-of.js +1 -0
- package/dist/augments/type/package-json.d.ts +177 -0
- package/dist/augments/type/package-json.js +1 -0
- package/dist/augments/type/partial-deep.d.ts +52 -0
- package/dist/augments/type/partial-deep.js +1 -0
- package/dist/augments/type/primitive-type.d.ts +11 -0
- package/dist/augments/type/primitive-type.js +1 -0
- package/dist/augments/type/promisable.d.ts +11 -0
- package/dist/augments/type/promisable.js +1 -0
- package/dist/augments/type/readonly-deep.d.ts +30 -0
- package/dist/augments/type/readonly-deep.js +1 -0
- package/dist/augments/type/readonly-keys-of.d.ts +20 -0
- package/dist/augments/type/readonly-keys-of.js +1 -0
- package/dist/augments/type/require-keys.d.ts +47 -0
- package/dist/augments/type/require-keys.js +1 -0
- package/dist/augments/type/require-one-or-none.d.ts +18 -0
- package/dist/augments/type/require-one-or-none.js +1 -0
- package/dist/augments/type/set-optional.d.ts +19 -0
- package/dist/augments/type/set-optional.js +1 -0
- package/dist/augments/type/set-required.d.ts +47 -0
- package/dist/augments/type/set-required.js +1 -0
- package/dist/augments/type/simplify.d.ts +14 -0
- package/dist/augments/type/simplify.js +1 -0
- package/dist/augments/type/subtract.d.ts +177 -0
- package/dist/augments/type/subtract.js +1 -0
- package/dist/augments/type/tagged.d.ts +30 -0
- package/dist/augments/type/tagged.js +1 -0
- package/dist/augments/type/type-checks.d.ts +33 -0
- package/dist/augments/type/type-checks.js +8 -0
- package/dist/augments/type/typed-array.d.ts +13 -0
- package/dist/augments/type/typed-array.js +1 -0
- package/dist/augments/type/undefined-to-optional.d.ts +27 -0
- package/dist/augments/type/undefined-to-optional.js +1 -0
- package/dist/augments/type/union-member.d.ts +14 -0
- package/dist/augments/type/union-member.js +1 -0
- package/dist/augments/type/union-to-intersection.d.ts +11 -0
- package/dist/augments/type/union-to-intersection.js +1 -0
- package/dist/augments/type/union-to-tuple.d.ts +21 -0
- package/dist/augments/type/union-to-tuple.js +1 -0
- package/dist/augments/type/unknown-array.d.ts +11 -0
- package/dist/augments/type/unknown-array.js +1 -0
- package/dist/augments/type/writable-deep.d.ts +32 -0
- package/dist/augments/type/writable-deep.js +1 -0
- package/dist/augments/type/writable-keys-of.d.ts +12 -0
- package/dist/augments/type/writable-keys-of.js +1 -0
- package/dist/augments/type/writable.d.ts +29 -0
- package/dist/augments/type/writable.js +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +43 -0
- package/package.json +2 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type BuiltIns, type HasMultipleCallSignatures } from './built-in-type.js';
|
|
2
|
+
type WritableMapDeep<MapType extends ReadonlyMap<unknown, unknown>> = MapType extends ReadonlyMap<infer KeyType, infer ValueType> ? Map<WritableDeep<KeyType>, WritableDeep<ValueType>> : MapType;
|
|
3
|
+
type WritableSetDeep<SetType extends ReadonlySet<unknown>> = SetType extends ReadonlySet<infer ItemType> ? Set<WritableDeep<ItemType>> : SetType;
|
|
4
|
+
type WritableObjectDeep<ObjectType extends object> = {
|
|
5
|
+
-readonly [KeyType in keyof ObjectType]: WritableDeep<ObjectType[KeyType]>;
|
|
6
|
+
};
|
|
7
|
+
type WritableArrayDeep<ArrayType extends readonly unknown[]> = ArrayType extends readonly [] ? [] : ArrayType extends readonly [
|
|
8
|
+
...infer U,
|
|
9
|
+
infer V
|
|
10
|
+
] ? [
|
|
11
|
+
...WritableArrayDeep<U>,
|
|
12
|
+
WritableDeep<V>
|
|
13
|
+
] : ArrayType extends readonly [
|
|
14
|
+
infer U,
|
|
15
|
+
...infer V
|
|
16
|
+
] ? [
|
|
17
|
+
WritableDeep<U>,
|
|
18
|
+
...WritableArrayDeep<V>
|
|
19
|
+
] : ArrayType extends ReadonlyArray<infer U> ? Array<WritableDeep<U>> : ArrayType extends Array<infer U> ? Array<WritableDeep<U>> : ArrayType;
|
|
20
|
+
/**
|
|
21
|
+
* Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type.
|
|
22
|
+
* The inverse of `ReadonlyDeep<T>`.
|
|
23
|
+
*
|
|
24
|
+
* Copied from the `WritableDeep` type in the `type-fest` package so that this package's public
|
|
25
|
+
* types do not depend on `type-fest` (see the note in `type-checks.ts`).
|
|
26
|
+
*
|
|
27
|
+
* @category Object
|
|
28
|
+
* @category Package : @augment-vir/common
|
|
29
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
30
|
+
*/
|
|
31
|
+
export type WritableDeep<T> = T extends BuiltIns ? T : T extends (...arguments_: any[]) => unknown ? {} extends WritableObjectDeep<T> ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & WritableObjectDeep<T> : T extends ReadonlyMap<unknown, unknown> ? WritableMapDeep<T> : T extends ReadonlySet<unknown> ? WritableSetDeep<T> : T extends readonly unknown[] ? WritableArrayDeep<T> : T extends object ? WritableObjectDeep<T> : unknown;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReadonlyKeysOf } from './readonly-keys-of.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extract all writable keys from the given type.
|
|
4
|
+
*
|
|
5
|
+
* Copied from the `WritableKeysOf` type in the `type-fest` package so that this package's public
|
|
6
|
+
* types do not depend on `type-fest` (see the note in `type-checks.ts`).
|
|
7
|
+
*
|
|
8
|
+
* @category Object
|
|
9
|
+
* @category Package : @augment-vir/common
|
|
10
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
11
|
+
*/
|
|
12
|
+
export type WritableKeysOf<Type extends object> = Type extends unknown ? Exclude<keyof Type, ReadonlyKeysOf<Type>> : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Except } from './except.js';
|
|
2
|
+
import { type Simplify } from './simplify.js';
|
|
3
|
+
type WritableArray<ArrayType extends readonly unknown[]> = ArrayType extends readonly [] ? [] : ArrayType extends readonly [
|
|
4
|
+
...infer U,
|
|
5
|
+
infer V
|
|
6
|
+
] ? [
|
|
7
|
+
...U,
|
|
8
|
+
V
|
|
9
|
+
] : ArrayType extends readonly [
|
|
10
|
+
infer U,
|
|
11
|
+
...infer V
|
|
12
|
+
] ? [
|
|
13
|
+
U,
|
|
14
|
+
...V
|
|
15
|
+
] : ArrayType extends ReadonlyArray<infer U> ? U[] : ArrayType;
|
|
16
|
+
/**
|
|
17
|
+
* Create a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.
|
|
18
|
+
*
|
|
19
|
+
* Copied from the `Writable` type in the `type-fest` package so that this package's public types do
|
|
20
|
+
* not depend on `type-fest` (see the note in `type-checks.ts`).
|
|
21
|
+
*
|
|
22
|
+
* @category Object
|
|
23
|
+
* @category Package : @augment-vir/common
|
|
24
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
25
|
+
*/
|
|
26
|
+
export type Writable<BaseType, Keys extends keyof BaseType = keyof BaseType> = BaseType extends ReadonlyMap<infer KeyType, infer ValueType> ? Map<KeyType, ValueType> : BaseType extends ReadonlySet<infer ItemType> ? Set<ItemType> : BaseType extends readonly unknown[] ? WritableArray<BaseType> : Simplify<Except<BaseType, Keys> & {
|
|
27
|
+
-readonly [KeyType in keyof Pick<BaseType, Keys>]: Pick<BaseType, Keys>[KeyType];
|
|
28
|
+
}>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,12 @@ export * from './augments/function/typed-function-type.js';
|
|
|
11
11
|
export * from './augments/http/http-method.js';
|
|
12
12
|
export * from './augments/http/http-status.js';
|
|
13
13
|
export * from './augments/json/json-compatible.js';
|
|
14
|
+
export * from './augments/json/json-value.js';
|
|
15
|
+
export * from './augments/json/jsonify.js';
|
|
14
16
|
export * from './augments/min-max.js';
|
|
15
17
|
export * from './augments/narrow-type.js';
|
|
16
18
|
export * from './augments/number/digit.js';
|
|
19
|
+
export * from './augments/number/infinity.js';
|
|
17
20
|
export * from './augments/object/generic-object-type.js';
|
|
18
21
|
export * from './augments/object/object-keys.js';
|
|
19
22
|
export * from './augments/object/object-sort.js';
|
|
@@ -36,4 +39,44 @@ export * from './augments/string/match.js';
|
|
|
36
39
|
export * from './augments/string/punctuation.js';
|
|
37
40
|
export * from './augments/string/remove-duplicate-characters.js';
|
|
38
41
|
export * from './augments/string/uuid.js';
|
|
42
|
+
export * from './augments/type/apply-default-options.js';
|
|
39
43
|
export * from './augments/type/branded-type.js';
|
|
44
|
+
export * from './augments/type/built-in-type.js';
|
|
45
|
+
export * from './augments/type/conditional-type.js';
|
|
46
|
+
export * from './augments/type/constructor-type.js';
|
|
47
|
+
export * from './augments/type/distributed-omit.js';
|
|
48
|
+
export * from './augments/type/empty-object.js';
|
|
49
|
+
export * from './augments/type/exact.js';
|
|
50
|
+
export * from './augments/type/except.js';
|
|
51
|
+
export * from './augments/type/exclude-exactly.js';
|
|
52
|
+
export * from './augments/type/is-unknown.js';
|
|
53
|
+
export * from './augments/type/keys-of-union.js';
|
|
54
|
+
export * from './augments/type/literal-union.js';
|
|
55
|
+
export * from './augments/type/merge.js';
|
|
56
|
+
export * from './augments/type/non-empty-string.js';
|
|
57
|
+
export * from './augments/type/omit-deep.js';
|
|
58
|
+
export * from './augments/type/omit-index-signature.js';
|
|
59
|
+
export * from './augments/type/optional-keys-of.js';
|
|
60
|
+
export * from './augments/type/package-json.js';
|
|
61
|
+
export * from './augments/type/partial-deep.js';
|
|
62
|
+
export * from './augments/type/primitive-type.js';
|
|
63
|
+
export * from './augments/type/promisable.js';
|
|
64
|
+
export * from './augments/type/readonly-deep.js';
|
|
65
|
+
export * from './augments/type/readonly-keys-of.js';
|
|
66
|
+
export * from './augments/type/require-keys.js';
|
|
67
|
+
export * from './augments/type/require-one-or-none.js';
|
|
68
|
+
export * from './augments/type/set-optional.js';
|
|
69
|
+
export * from './augments/type/set-required.js';
|
|
70
|
+
export * from './augments/type/simplify.js';
|
|
71
|
+
export * from './augments/type/subtract.js';
|
|
72
|
+
export * from './augments/type/tagged.js';
|
|
73
|
+
export * from './augments/type/type-checks.js';
|
|
74
|
+
export * from './augments/type/typed-array.js';
|
|
75
|
+
export * from './augments/type/undefined-to-optional.js';
|
|
76
|
+
export * from './augments/type/union-member.js';
|
|
77
|
+
export * from './augments/type/union-to-intersection.js';
|
|
78
|
+
export * from './augments/type/union-to-tuple.js';
|
|
79
|
+
export * from './augments/type/unknown-array.js';
|
|
80
|
+
export * from './augments/type/writable-deep.js';
|
|
81
|
+
export * from './augments/type/writable-keys-of.js';
|
|
82
|
+
export * from './augments/type/writable.js';
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,12 @@ export * from './augments/function/typed-function-type.js';
|
|
|
11
11
|
export * from './augments/http/http-method.js';
|
|
12
12
|
export * from './augments/http/http-status.js';
|
|
13
13
|
export * from './augments/json/json-compatible.js';
|
|
14
|
+
export * from './augments/json/json-value.js';
|
|
15
|
+
export * from './augments/json/jsonify.js';
|
|
14
16
|
export * from './augments/min-max.js';
|
|
15
17
|
export * from './augments/narrow-type.js';
|
|
16
18
|
export * from './augments/number/digit.js';
|
|
19
|
+
export * from './augments/number/infinity.js';
|
|
17
20
|
export * from './augments/object/generic-object-type.js';
|
|
18
21
|
export * from './augments/object/object-keys.js';
|
|
19
22
|
export * from './augments/object/object-sort.js';
|
|
@@ -36,4 +39,44 @@ export * from './augments/string/match.js';
|
|
|
36
39
|
export * from './augments/string/punctuation.js';
|
|
37
40
|
export * from './augments/string/remove-duplicate-characters.js';
|
|
38
41
|
export * from './augments/string/uuid.js';
|
|
42
|
+
export * from './augments/type/apply-default-options.js';
|
|
39
43
|
export * from './augments/type/branded-type.js';
|
|
44
|
+
export * from './augments/type/built-in-type.js';
|
|
45
|
+
export * from './augments/type/conditional-type.js';
|
|
46
|
+
export * from './augments/type/constructor-type.js';
|
|
47
|
+
export * from './augments/type/distributed-omit.js';
|
|
48
|
+
export * from './augments/type/empty-object.js';
|
|
49
|
+
export * from './augments/type/exact.js';
|
|
50
|
+
export * from './augments/type/except.js';
|
|
51
|
+
export * from './augments/type/exclude-exactly.js';
|
|
52
|
+
export * from './augments/type/is-unknown.js';
|
|
53
|
+
export * from './augments/type/keys-of-union.js';
|
|
54
|
+
export * from './augments/type/literal-union.js';
|
|
55
|
+
export * from './augments/type/merge.js';
|
|
56
|
+
export * from './augments/type/non-empty-string.js';
|
|
57
|
+
export * from './augments/type/omit-deep.js';
|
|
58
|
+
export * from './augments/type/omit-index-signature.js';
|
|
59
|
+
export * from './augments/type/optional-keys-of.js';
|
|
60
|
+
export * from './augments/type/package-json.js';
|
|
61
|
+
export * from './augments/type/partial-deep.js';
|
|
62
|
+
export * from './augments/type/primitive-type.js';
|
|
63
|
+
export * from './augments/type/promisable.js';
|
|
64
|
+
export * from './augments/type/readonly-deep.js';
|
|
65
|
+
export * from './augments/type/readonly-keys-of.js';
|
|
66
|
+
export * from './augments/type/require-keys.js';
|
|
67
|
+
export * from './augments/type/require-one-or-none.js';
|
|
68
|
+
export * from './augments/type/set-optional.js';
|
|
69
|
+
export * from './augments/type/set-required.js';
|
|
70
|
+
export * from './augments/type/simplify.js';
|
|
71
|
+
export * from './augments/type/subtract.js';
|
|
72
|
+
export * from './augments/type/tagged.js';
|
|
73
|
+
export * from './augments/type/type-checks.js';
|
|
74
|
+
export * from './augments/type/typed-array.js';
|
|
75
|
+
export * from './augments/type/undefined-to-optional.js';
|
|
76
|
+
export * from './augments/type/union-member.js';
|
|
77
|
+
export * from './augments/type/union-to-intersection.js';
|
|
78
|
+
export * from './augments/type/union-to-tuple.js';
|
|
79
|
+
export * from './augments/type/unknown-array.js';
|
|
80
|
+
export * from './augments/type/writable-deep.js';
|
|
81
|
+
export * from './augments/type/writable-keys-of.js';
|
|
82
|
+
export * from './augments/type/writable.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/core",
|
|
3
|
-
"version": "32.1
|
|
3
|
+
"version": "32.2.1",
|
|
4
4
|
"description": "Core augment-vir augments. Use @augment-vir/common instead.",
|
|
5
5
|
"homepage": "https://github.com/electrovir/augment-vir",
|
|
6
6
|
"bugs": {
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"@date-vir/duration": "^8.6.1",
|
|
32
32
|
"browser-or-node": "^3.0.0",
|
|
33
33
|
"diff": "^9.0.0",
|
|
34
|
-
"json5": "^2.2.3"
|
|
35
|
-
"type-fest": "^5.7.0"
|
|
34
|
+
"json5": "^2.2.3"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@types/node": "^26.0.1",
|