type-plus 4.5.0 → 4.6.0

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 (120) hide show
  1. package/README.md +3 -1
  2. package/cjs/ComposableTypes.d.ts +0 -6
  3. package/cjs/JSONTypes.js +0 -1
  4. package/cjs/JSONTypes.js.map +1 -1
  5. package/cjs/UnionKeys.d.ts +0 -4
  6. package/cjs/array/CommonPropKeys.d.ts +0 -7
  7. package/cjs/array/CreateTuple.d.ts +10 -8
  8. package/cjs/array/DropMatch.d.ts +5 -0
  9. package/cjs/array/DropMatch.js +3 -0
  10. package/cjs/array/DropMatch.js.map +1 -0
  11. package/cjs/array/Filter.d.ts +2 -1
  12. package/cjs/array/FindFirst.d.ts +0 -3
  13. package/cjs/array/IntersectOfProps.d.ts +0 -7
  14. package/cjs/array/Last.d.ts +0 -3
  15. package/cjs/array/Tail.d.ts +0 -3
  16. package/cjs/array/UnionOfProps.d.ts +0 -7
  17. package/cjs/array/UnionOfValues.d.ts +0 -7
  18. package/cjs/array/index.d.ts +2 -1
  19. package/cjs/array/index.js.map +1 -1
  20. package/cjs/assertion/assertType.d.ts +0 -4
  21. package/cjs/assertion/assertType.js +0 -8
  22. package/cjs/assertion/assertType.js.map +1 -1
  23. package/cjs/functional/ChainFn.d.ts +0 -3
  24. package/cjs/functional/compose.d.ts +0 -3
  25. package/cjs/functional/compose.js +0 -3
  26. package/cjs/functional/compose.js.map +1 -1
  27. package/cjs/index.js +0 -2
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/math/Add.d.ts +0 -6
  30. package/cjs/math/Digit.d.ts +20 -23
  31. package/cjs/math/IsPositive.d.ts +0 -5
  32. package/cjs/math/IsWhole.d.ts +0 -5
  33. package/cjs/math/Subtract.d.ts +0 -3
  34. package/cjs/nodejs/isNodeError.d.ts +0 -5
  35. package/cjs/nodejs/isNodeError.js +0 -5
  36. package/cjs/nodejs/isNodeError.js.map +1 -1
  37. package/cjs/nominal-types/Brand.d.ts +0 -10
  38. package/cjs/nominal-types/Brand.js +0 -3
  39. package/cjs/nominal-types/Brand.js.map +1 -1
  40. package/cjs/nominal-types/Flavor.d.ts +0 -12
  41. package/cjs/nominal-types/Flavor.js +0 -3
  42. package/cjs/nominal-types/Flavor.js.map +1 -1
  43. package/cjs/object/ExcludePropType.d.ts +0 -3
  44. package/cjs/object/IsDisjoint.d.ts +0 -4
  45. package/cjs/object/KeyTypes.d.ts +0 -5
  46. package/cjs/object/KeyofOptional.d.ts +0 -3
  47. package/cjs/object/KnownKeys.js +0 -3
  48. package/cjs/object/KnownKeys.js.map +1 -1
  49. package/cjs/object/Partial.d.ts +0 -9
  50. package/cjs/object/RecursiveIntersect.d.ts +0 -11
  51. package/cjs/object/Required.js +0 -1
  52. package/cjs/object/Required.js.map +1 -1
  53. package/cjs/object/facade.d.ts +0 -3
  54. package/cjs/object/facade.js +0 -3
  55. package/cjs/object/facade.js.map +1 -1
  56. package/cjs/object/mapProperties.d.ts +0 -8
  57. package/cjs/object/mapProperties.js +0 -8
  58. package/cjs/object/mapProperties.js.map +1 -1
  59. package/cjs/object/omit.d.ts +0 -3
  60. package/cjs/object/pick.d.ts +0 -7
  61. package/cjs/object/record.d.ts +0 -3
  62. package/cjs/object/record.js +0 -3
  63. package/cjs/object/record.js.map +1 -1
  64. package/cjs/object/reduceKey.d.ts +0 -3
  65. package/cjs/object/reduceKey.js +0 -3
  66. package/cjs/object/reduceKey.js.map +1 -1
  67. package/cjs/object/split.d.ts +0 -4
  68. package/cjs/predicates/CanAssign.d.ts +0 -3
  69. package/cjs/predicates/Equal.d.ts +0 -6
  70. package/cjs/predicates/isType.js +0 -6
  71. package/cjs/predicates/isType.js.map +1 -1
  72. package/cjs/promise/PromiseValue.d.ts +0 -3
  73. package/cjs/promise/PromiseValueMerge.d.ts +0 -3
  74. package/cjs/promise/isPromise.js +0 -1
  75. package/cjs/promise/isPromise.js.map +1 -1
  76. package/cjs/utils/Widen.d.ts +0 -4
  77. package/esm/JSONTypes.js +0 -1
  78. package/esm/JSONTypes.js.map +1 -1
  79. package/esm/array/DropMatch.js +2 -0
  80. package/esm/array/DropMatch.js.map +1 -0
  81. package/esm/array/index.js.map +1 -1
  82. package/esm/assertion/assertType.js +0 -8
  83. package/esm/assertion/assertType.js.map +1 -1
  84. package/esm/functional/compose.js +0 -3
  85. package/esm/functional/compose.js.map +1 -1
  86. package/esm/index.js +0 -2
  87. package/esm/index.js.map +1 -1
  88. package/esm/nodejs/isNodeError.js +0 -5
  89. package/esm/nodejs/isNodeError.js.map +1 -1
  90. package/esm/nominal-types/Brand.js +0 -3
  91. package/esm/nominal-types/Brand.js.map +1 -1
  92. package/esm/nominal-types/Flavor.js +0 -3
  93. package/esm/nominal-types/Flavor.js.map +1 -1
  94. package/esm/object/KnownKeys.js +0 -3
  95. package/esm/object/KnownKeys.js.map +1 -1
  96. package/esm/object/Required.js +0 -1
  97. package/esm/object/Required.js.map +1 -1
  98. package/esm/object/facade.js +0 -3
  99. package/esm/object/facade.js.map +1 -1
  100. package/esm/object/mapProperties.js +0 -8
  101. package/esm/object/mapProperties.js.map +1 -1
  102. package/esm/object/record.js +0 -3
  103. package/esm/object/record.js.map +1 -1
  104. package/esm/object/reduceKey.js +0 -3
  105. package/esm/object/reduceKey.js.map +1 -1
  106. package/esm/predicates/isType.js +0 -6
  107. package/esm/predicates/isType.js.map +1 -1
  108. package/esm/promise/isPromise.js +0 -1
  109. package/esm/promise/isPromise.js.map +1 -1
  110. package/package.json +1 -1
  111. package/ts/array/CreateTuple.spec.ts +32 -21
  112. package/ts/array/CreateTuple.ts +30 -7
  113. package/ts/array/DropMatch.spec.ts +113 -0
  114. package/ts/array/DropMatch.ts +53 -0
  115. package/ts/array/Filter.spec.ts +107 -21
  116. package/ts/array/Filter.ts +26 -12
  117. package/ts/array/index.ts +2 -1
  118. package/ts/math/Add.spec.ts +82 -82
  119. package/ts/math/Digit.spec.ts +184 -185
  120. package/ts/math/Digit.ts +20 -20
package/README.md CHANGED
@@ -285,12 +285,14 @@ type No = IsAny<1, 'yes', 'no'> // 'no'
285
285
  - `CreateTuple<L, T>`: Creates `Tuple<T>` with `L` number of elements.
286
286
  - `DropFirst<A>`: drops the first value type of `A`.
287
287
  - `DropLast<A>`: drops the last value type of `A`.
288
- - `Filter<A, Criteria>`: gets the array of types satisfying `Criteria` in `A`.
288
+ - `DropMatch<A, Criteria>`: drops entries matching `Criteria` in array or tuple `A`.
289
+ - `Filter<A, Criteria>`: filter the array or tuple `A`, keeping entries satisfying `Criteria`. **deprecated. Renaming to `KeepMatch`**
289
290
  - `FindFirst<A, Criteria>`: gets the first type satisfying `Criteria`.
290
291
  - `FindLast<A, Criteria>`: gets the last type satisfying `Criteria`.
291
292
  - `Head<A>`: gets the first entry in the array.
292
293
  - `IntersectOfProps<A, K>`: gets the intersect of `A[K]` types (deprecate `MapToProp`)
293
294
  - `IsArray<T>`: `logical` predicate for `Array`.
295
+ - `KeepMatch<A, Criteria>`: keeps entries satisfying `Criteria` in array or tuple `A`.
294
296
  - `Last<A>`: gets the last type of an array or tuple.
295
297
  - `literalArray(...entries)`: return an array whose items are restricted to the provided literals.
296
298
  - `PadLeft<A, Total, PadWith>`: pads `A` with `PadWith` if the length of `A` is less than `L`.
@@ -1,8 +1,2 @@
1
- /**
2
- * Types that can contain custom properties.
3
- */
4
1
  export declare type ComposableTypes = object | Function;
5
- /**
6
- * Types that cannot contain custom properties.
7
- */
8
2
  export declare type NonComposableTypes = boolean | number | string | symbol | bigint | undefined | null;
package/cjs/JSONTypes.js CHANGED
@@ -21,7 +21,6 @@ function get(obj) {
21
21
  if (typeof obj !== 'object' || obj === null)
22
22
  return undefined;
23
23
  var p = props.shift();
24
- // @ts-ignore
25
24
  return get.apply(void 0, __spreadArray([obj[p]], props, false));
26
25
  }
27
26
  //# sourceMappingURL=JSONTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JSONTypes.js","sourceRoot":"","sources":["../ts/JSONTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;AASa,QAAA,SAAS,GAAG,EAAE,GAAG,KAAA,EAAE,CAAA;AAEhC,SAAS,GAAG,CAAsB,GAAc;IAAE,eAAgC;SAAhC,UAAgC,EAAhC,qBAAgC,EAAhC,IAAgC;QAAhC,8BAAgC;;IAChF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAQ,CAAA;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IAC7D,IAAM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAG,CAAA;IACxB,aAAa;IACb,OAAO,GAAG,8BAAC,GAAG,CAAC,CAAC,CAAC,GAAK,KAAK,SAAM,CAAA;AACnC,CAAC"}
1
+ {"version":3,"file":"JSONTypes.js","sourceRoot":"","sources":["../ts/JSONTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;AASa,QAAA,SAAS,GAAG,EAAE,GAAG,KAAA,EAAE,CAAA;AAEhC,SAAS,GAAG,CAAsB,GAAc;IAAE,eAAgC;SAAhC,UAAgC,EAAhC,qBAAgC,EAAhC,IAAgC;QAAhC,8BAAgC;;IAChF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAQ,CAAA;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IAC7D,IAAM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAG,CAAA;IAExB,OAAO,GAAG,8BAAC,GAAG,CAAC,CAAC,CAAC,GAAK,KAAK,SAAM,CAAA;AACnC,CAAC"}
@@ -1,5 +1 @@
1
- /**
2
- * `UnionKeys<T>` will distribute keys of an union to individual types.
3
- * This should be used in conjuncture with distributive types.
4
- */
5
1
  export declare type UnionKeys<T> = keyof T | (T extends unknown ? keyof T : never);
@@ -1,10 +1,3 @@
1
1
  import { Tail } from './Tail';
2
- /**
3
- * Gets the common property keys of the elements in `A`.
4
- */
5
2
  export declare type CommonPropKeys<A extends Record<string, unknown>[]> = A['length'] extends 0 ? never : (A['length'] extends 1 ? keyof A[0] : (A['length'] extends 2 ? keyof A[0] & keyof A[1] : keyof A[0] & keyof A[1] & CommonPropKeys<Tail<Tail<A>>>));
6
- /**
7
- * Gets the common property keys of the elements in `A`.
8
- * This will be deprecated in 4.0. Please use CommonPropKeys instead.
9
- */
10
3
  export declare type CommonKeys<A extends Record<string, any>[]> = CommonPropKeys<A>;
@@ -1,8 +1,10 @@
1
- import type { IsPositive } from '../math';
2
- /**
3
- * Creates `Tuple<T>` with `L` number of elements.
4
- */
5
- export declare type CreateTuple<L extends number, T = any> = IsPositive<L> extends true ? CreateTuple.Device<[], L, T> : never;
6
- export declare namespace CreateTuple {
7
- type Device<R extends any[], L extends number, T> = R['length'] extends L ? R : Device<[T, ...R], L, T>;
8
- }
1
+ import { IsPositive } from '../math';
2
+ declare type BuildPowersOf2LengthArrays<N extends number, R extends never[][]> = R[0][N] extends never ? R : BuildPowersOf2LengthArrays<N, [[...R[0], ...R[0]], ...R]>;
3
+ declare type ConcatLargestUntilDone<N extends number, R extends never[][], B extends never[]> = B['length'] extends N ? B : [...R[0], ...B][N] extends never ? ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, B> : ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, [...R[0], ...B]>;
4
+ declare type Replace<R extends any[], T> = {
5
+ [K in keyof R]: T;
6
+ };
7
+ export declare type CreateTuple<L extends number, T = any> = number extends L ? T[] : IsPositive<L> extends true ? {
8
+ [K in L]: BuildPowersOf2LengthArrays<K, [[never]]> extends infer U ? (U extends never[][] ? Replace<ConcatLargestUntilDone<K, U, []>, T> : never) : never;
9
+ }[L] : never;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Equal } from '../predicates';
2
+ declare type ExcludeUnionOfEmptyTuple<A> = Equal<A, []> extends true ? A : Exclude<A, []>;
3
+ export declare type DropMatch<A extends Array<any>, Criteria> = number extends A['length'] ? (A[0] extends Criteria ? never[] : (undefined extends Criteria ? Array<NonNullable<A[0]>> : (Criteria extends A[0] ? Array<Exclude<A[0], Criteria>> : A))) : DropMatchTuple<A, Criteria>;
4
+ declare type DropMatchTuple<A extends Array<any>, Criteria> = (A['length'] extends 0 ? A : (A extends [infer Head, ...infer Tail] ? (Tail['length'] extends 0 ? (undefined extends Criteria ? (Head extends Criteria ? [] : [Head]) : ExcludeUnionOfEmptyTuple<(Head extends Criteria ? [] : [Head])>) : (Exclude<Head, Criteria> extends never ? DropMatch<Tail, Criteria> : [Exclude<Head, Criteria>, ...DropMatch<Tail, Criteria>])) : never[]));
5
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DropMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropMatch.js","sourceRoot":"","sources":["../../ts/array/DropMatch.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
- export declare type Filter<A extends Array<any>, Criteria> = number extends A['length'] ? (A[0] extends Criteria ? A : never[]) : (A['length'] extends 0 ? never : (A extends [infer Head, ...infer Tail] ? (Tail['length'] extends 0 ? (Head extends Criteria ? [Head] : never[]) : (Head extends Criteria ? [Head, ...Filter<Tail, Criteria>] : Filter<Tail, Criteria>)) : never));
1
+ export declare type Filter<A extends Array<any>, Criteria> = number extends A['length'] ? (A[0] extends Criteria ? A : (Criteria extends A[0] ? Array<Criteria> : never[])) : (A['length'] extends 0 ? never : (A extends [infer Head, ...infer Tail] ? (Tail['length'] extends 0 ? (Head extends Criteria ? [Head] : never[]) : (Head extends Criteria ? [Head, ...Filter<Tail, Criteria>] : Filter<Tail, Criteria>)) : never));
2
+ export declare type KeepMatch<A extends Array<any>, Criteria> = Filter<A, Criteria>;
@@ -1,5 +1,2 @@
1
1
  export declare type FindFirst<A extends Array<any>, Criteria> = (number extends A['length'] ? A[0] extends Criteria ? A[0] : never : (A['length'] extends 0 ? never : (A extends [any, ...infer Tail] ? A[0] extends Criteria ? A[0] : FindFirst<Tail, Criteria> : never)));
2
- /**
3
- * @deprecated use FindFirst
4
- */
5
2
  export declare type First<A extends any[], Criteria> = FindFirst<A, Criteria>;
@@ -1,11 +1,4 @@
1
1
  import { KeyTypes } from '../object';
2
2
  import { Tail } from './Tail';
3
- /**
4
- * Gets the intersect of properties of the elements in `A`
5
- */
6
3
  export declare type IntersectOfProps<A extends Record<any, unknown>[], P extends KeyTypes> = A['length'] extends 0 ? never : (A['length'] extends 1 ? A[0][P] : A[0][P] & IntersectOfProps<Tail<A>, P>);
7
- /**
8
- * Gets the intersect of properties of the elements in `A`
9
- * This will be deprecated in 4.0. Please use IntersectOfProps instead.
10
- */
11
4
  export declare type MapToProp<A extends Record<any, any>[], P extends KeyTypes> = IntersectOfProps<A, P>;
@@ -1,4 +1 @@
1
- /**
2
- * Get the last type of an array or tuple.
3
- */
4
1
  export declare type Last<T extends any[]> = T extends [...any[], infer R] ? R : T[0];
@@ -1,5 +1,2 @@
1
1
  import { UnionOfValues } from './UnionOfValues';
2
- /**
3
- * Gets the types of a tuple except the first entry.
4
- */
5
2
  export declare type Tail<T extends any[]> = T['length'] extends 0 ? never : (T extends [any, ...infer Tail] ? (Tail extends UnionOfValues<T>[] ? Tail : never) : T);
@@ -1,11 +1,4 @@
1
1
  import { KeyTypes } from '../object';
2
2
  import { Tail } from './Tail';
3
- /**
4
- * Gets the union of properties of the elements in `A`
5
- */
6
3
  export declare type UnionOfProps<A extends Record<any, any>[], P extends KeyTypes> = A['length'] extends 0 ? never : (A['length'] extends 1 ? A[0][P] : A[0][P] | UnionOfProps<Tail<A>, P>);
7
- /**
8
- * Gets the union of properties in the element of `A`
9
- * This will be deprecated in 4.0. Please use UnionOfProps instead.
10
- */
11
4
  export declare type PropUnion<A extends Record<any, any>[], P extends KeyTypes> = UnionOfProps<A, P>;
@@ -1,9 +1,2 @@
1
- /**
2
- * Gets the union of value types in `A`
3
- */
4
1
  export declare type UnionOfValues<A extends Array<any>> = A extends Array<infer E> ? E : never;
5
- /**
6
- * Gets the union of value types in `A`
7
- * This will be deprecated in 4.0. Please use UnionOfValues instead.
8
- */
9
2
  export declare type ArrayValue<A extends any[]> = UnionOfValues<A>;
@@ -3,7 +3,8 @@ export type { Concat } from './Concat';
3
3
  export type { CreateTuple } from './CreateTuple';
4
4
  export type { DropFirst } from './DropFirst';
5
5
  export type { DropLast } from './DropLast';
6
- export type { Filter } from './Filter';
6
+ export type { DropMatch } from './DropMatch';
7
+ export type { Filter, KeepMatch } from './Filter';
7
8
  export type { FindFirst, First } from './FindFirst';
8
9
  export type { FindLast } from './FindLast';
9
10
  export type { Head } from './Head';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAYA,iDAA8B;AAE9B,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/array/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAaA,iDAA8B;AAE9B,gDAA6B"}
@@ -1,9 +1,5 @@
1
1
  import { AnyConstructor } from '../class';
2
2
  import { AnyFunction } from '../function';
3
- /**
4
- * assert the subject satisfies the specified type T
5
- * @type T the type to check against.
6
- */
7
3
  export declare function assertType<T>(subject: T): asserts subject is T;
8
4
  export declare function assertType<T>(subject: unknown, validator: (s: T) => boolean): asserts subject is T;
9
5
  export declare function assertType<T extends new (...args: any) => any>(subject: unknown, constructor: T): asserts subject is InstanceType<T>;
@@ -48,7 +48,6 @@ assertType.isTrue = function (subject) {
48
48
  throw TypeError("subject is not true");
49
49
  };
50
50
  assertType.noTrue = function (subject) {
51
- // @ts-ignore
52
51
  if (subject === true)
53
52
  throw TypeError("subject is true");
54
53
  };
@@ -57,7 +56,6 @@ assertType.isFalse = function (subject) {
57
56
  throw TypeError("subject is not false");
58
57
  };
59
58
  assertType.noFalse = function (subject) {
60
- // @ts-ignore
61
59
  if (subject === false)
62
60
  throw TypeError("subject is false");
63
61
  };
@@ -91,12 +89,6 @@ assertType.noError = function (subject) {
91
89
  };
92
90
  assertType.isNever = function (subject) {
93
91
  };
94
- /**
95
- * creates a custom assertion function with standard TypeError.
96
- * Currently this requires explicity type annotation,
97
- * thus making it hard to use:
98
- * https://github.com/microsoft/TypeScript/issues/41047
99
- */
100
92
  assertType.custom = function (validator) {
101
93
  return function (subject) {
102
94
  if (!validator(subject))
@@ -1 +1 @@
1
- {"version":3,"file":"assertType.js","sourceRoot":"","sources":["../../ts/assertion/assertType.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AACjC,kCAAwD;AAUxD,SAAgB,UAAU,CAAC,OAAgB,EAAE,SAA+B;IAC1E,IAAI,SAAS,EAAE;QACb,IAAI,CAAC,IAAA,qBAAa,EAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YACtF,MAAM,IAAI,SAAS,CAAC,mCAA4B,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAE,CAAC,CAAA;KACxE;IACD,OAAM;AACR,CAAC;AAND,gCAMC;AAED,UAAU,CAAC,WAAW,GAAG,UAAU,OAAkB;IACnD,IAAI,OAAO,OAAO,KAAK,WAAW;QAAE,MAAM,SAAS,CAAC,0BAA0B,CAAC,CAAA;AACjF,CAAC,CAAA;AACD,UAAU,CAAC,WAAW,GAAG,UAAa,OAA8B;IAClE,IAAI,OAAO,OAAO,KAAK,WAAW;QAAE,MAAM,SAAS,CAAC,sBAAsB,CAAC,CAAA;AAC7E,CAAC,CAAA;AAED,UAAU,CAAC,MAAM,GAAG,UAAU,OAAa;IACzC,IAAI,OAAO,KAAK,IAAI;QAAE,MAAM,SAAS,CAAC,qBAAqB,CAAC,CAAA;AAC9D,CAAC,CAAA;AACD,UAAU,CAAC,MAAM,GAAG,UAAa,OAA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AAC,mBAAmB,CAAC,CAAA;AACvE,CAAC,CAAA;AAED,UAAU,CAAC,UAAU,GAAG,UAAU,OAAoB;IACpD,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,MAAM,SAAS,CAAC,yBAAyB,CAAC,CAAA;AAC/E,CAAC,CAAA;AACD,UAAU,CAAC,UAAU,GAAG,UAAa,OAAgC;IACnE,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,MAAM,SAAS,CAAC,qBAAqB,CAAC,CAAA;AAC3E,CAAC,CAAA;AAED,UAAU,CAAC,aAAa,GAAG,UAAU,OAAuB;IAC1D,IAAI,CAAC,IAAA,qBAAa,EAAC,OAAO,CAAC;QAAE,MAAM,SAAS,CAAC,8BAA8B,CAAC,CAAA;AAC9E,CAAC,CAAA;AAED,UAAU,CAAC,OAAO,GAAG,UAAU,OAAc;IAC3C,IAAI,CAAC,CAAC,OAAO,YAAY,KAAK,CAAC;QAAE,MAAM,SAAS,CAAC,yBAAyB,CAAC,CAAA;AAC7E,CAAC,CAAA;AACD,UAAU,CAAC,OAAO,GAAG,UAAa,OAA0B;IAC1D,IAAI,OAAO,YAAY,KAAK;QAAE,MAAM,SAAS,CAAC,qBAAqB,CAAC,CAAA;AACtE,CAAC,CAAA;AAED,UAAU,CAAC,OAAO,GAAG,UAAU,OAAc;AAC7C,CAAC,CAAA;AAQD,UAAU,CAAC,MAAM,GAAG,UAClB,SAA4B;IAE5B,OAAO,UAAU,OAAO;QACtB,IAAI,CAAC,SAAS,CAAC,OAAc,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,mCAA4B,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAE,CAAC,CAAA;QACrG,OAAM;IACR,CAAC,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +1,2 @@
1
1
  export declare type ChainFn<T> = (param: T) => T;
2
- /**
3
- * An endofunctor is a functor from one category back to the same category.
4
- */
5
2
  export declare type EndoFn<T> = (param: T) => T;
@@ -1,6 +1,3 @@
1
1
  import { Head, Last } from '../array';
2
2
  import { AnyFunction } from '../function/AnyFunction';
3
- /**
4
- * compose functions
5
- */
6
3
  export declare function compose<FS extends AnyFunction[]>(...fns: FS): (...args: Parameters<Head<FS>>) => ReturnType<Last<FS>>;
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.compose = void 0;
4
- /**
5
- * compose functions
6
- */
7
4
  function compose() {
8
5
  var fns = [];
9
6
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../ts/functional/compose.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,SAAgB,OAAO;IAA2B,aAAU;SAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;QAAV,wBAAU;;IAC1D,OAAO;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAAK,OAAA,GAAG,CAAC,MAAM,CAAC,UAAC,IAAI,EAAE,EAAE,IAAK,OAAA,CAAC,EAAE,eAAI,IAAI,EAAE,EAAb,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAQ;IAAvD,CAAuD,CAAA;AACpF,CAAC;AAFD,0BAEC"}
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../ts/functional/compose.ts"],"names":[],"mappings":";;;AAMA,SAAgB,OAAO;IAA2B,aAAU;SAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;QAAV,wBAAU;;IAC1D,OAAO;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAAK,OAAA,GAAG,CAAC,MAAM,CAAC,UAAC,IAAI,EAAE,EAAE,IAAK,OAAA,CAAC,EAAE,eAAI,IAAI,EAAE,EAAb,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAQ;IAAvD,CAAuD,CAAA;AACpF,CAAC;AAFD,0BAEC"}
package/cjs/index.js CHANGED
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.requiredDeep = exports.required = void 0;
18
- // import * as types from './types'
19
18
  var unpartial_1 = require("unpartial");
20
19
  Object.defineProperty(exports, "required", { enumerable: true, get: function () { return unpartial_1.required; } });
21
20
  Object.defineProperty(exports, "requiredDeep", { enumerable: true, get: function () { return unpartial_1.requiredDeep; } });
@@ -33,5 +32,4 @@ __exportStar(require("./predicates"), exports);
33
32
  __exportStar(require("./promise"), exports);
34
33
  __exportStar(require("./testing"), exports);
35
34
  __exportStar(require("./utils"), exports);
36
- // export { types, types as T }
37
35
  //# sourceMappingURL=index.js.map
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;AACzB,4CAAyB;AAIzB,0CAAuB;AACvB,+BAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,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;AACzB,4CAAyB;AAIzB,0CAAuB"}
package/cjs/math/Add.d.ts CHANGED
@@ -4,9 +4,6 @@ import type { Digit, DigitArray } from './Digit';
4
4
  import type { IsPositive } from './IsPositive';
5
5
  import type { IsWhole } from './IsWhole';
6
6
  import type { Max } from './Max';
7
- /**
8
- * Add two number literals.
9
- */
10
7
  export declare type Add<A extends number, B extends number, Fail = never> = And<And<IsPositive<A>, IsWhole<A>>, And<IsPositive<B>, IsWhole<B>>> extends false ? Fail : DigitArray.FromNumber<A> extends infer DA ? DA extends number[] ? DigitArray.FromNumber<B> extends infer DB ? DB extends number[] ? Max<DA['length'], DB['length']> extends infer M ? M extends number ? PadLeft<DA, M, 0> extends infer PDA ? PDA extends number[] ? PadLeft<DB, M, 0> extends infer PDB ? PDB extends number[] ? DigitArray.ToNumber<Add.DigitArray<PDA, PDB>> : Fail : Fail : Fail : Fail : Fail : Fail : Fail : Fail : Fail : Fail;
11
8
  export declare namespace Add {
12
9
  type DigitArray<A extends number[], B extends number[]> = (A extends [any, ...infer ATail] ? (ATail extends number[] ? (B extends [any, ...infer BTail] ? (BTail extends number[] ? [Digit<A[0], B[0]>, ...DigitArray<ATail, BTail>] : []) : [A[0], ...DigitArray<[], ATail>]) : []) : (B extends [any, ...infer BTail] ? (BTail extends number[] ? [B[0], ...DigitArray<[], BTail>] : []) : []));
@@ -15,7 +12,4 @@ export declare namespace Add {
15
12
  ...Digit.ToTuple[B]
16
13
  ]['length'];
17
14
  }
18
- /**
19
- * Increment `A` by 1.
20
- */
21
15
  export declare type Increment<A extends number, Fail = never> = Add<A, 1, Fail>;
@@ -3,33 +3,30 @@ import { And } from '../predicates';
3
3
  import { IsPositive } from './IsPositive';
4
4
  import { IsWhole } from './IsWhole';
5
5
  export declare namespace Digit {
6
- type ToTuple = {
6
+ type ToTuple<T = 1> = {
7
7
  [k in number]: any[];
8
8
  } & {
9
9
  0: [];
10
- 1: [1];
11
- 2: [1, 1];
12
- 3: [1, 1, 1];
13
- 4: [1, 1, 1, 1];
14
- 5: [1, 1, 1, 1, 1];
15
- 6: [1, 1, 1, 1, 1, 1];
16
- 7: [1, 1, 1, 1, 1, 1, 1];
17
- 8: [1, 1, 1, 1, 1, 1, 1, 1];
18
- 9: [1, 1, 1, 1, 1, 1, 1, 1, 1];
19
- 10: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
20
- 11: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
21
- 12: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
22
- 13: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
23
- 14: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
24
- 15: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
25
- 16: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
26
- 17: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
27
- 18: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28
- 19: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
10
+ 1: [T];
11
+ 2: [T, T];
12
+ 3: [T, T, T];
13
+ 4: [T, T, T, T];
14
+ 5: [T, T, T, T, T];
15
+ 6: [T, T, T, T, T, T];
16
+ 7: [T, T, T, T, T, T, T];
17
+ 8: [T, T, T, T, T, T, T, T];
18
+ 9: [T, T, T, T, T, T, T, T, T];
19
+ 10: [T, T, T, T, T, T, T, T, T, T];
20
+ 11: [T, T, T, T, T, T, T, T, T, T, T];
21
+ 12: [T, T, T, T, T, T, T, T, T, T, T, T];
22
+ 13: [T, T, T, T, T, T, T, T, T, T, T, T, T];
23
+ 14: [T, T, T, T, T, T, T, T, T, T, T, T, T, T];
24
+ 15: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
25
+ 16: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
26
+ 17: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
27
+ 18: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
28
+ 19: [T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T];
29
29
  };
30
- /**
31
- * A > B for [1-9]
32
- */
33
30
  type GreaterThan<A extends number, B extends number> = B extends GreaterThanMap[A] ? true : false;
34
31
  type GreaterThanMap = {
35
32
  [k in number]: number;
@@ -1,6 +1 @@
1
- /**
2
- * Check if type of positive number literal
3
- * `number` type is false as it can be negative.
4
- * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
5
- */
6
1
  export declare type IsPositive<N extends number, Then = true, Else = false> = number extends N ? Else : `${N}` extends `-${number}` ? Else : Then;
@@ -1,6 +1 @@
1
- /**
2
- * Check if type is whole number literal.
3
- * `number` type is false as it can be fractional.
4
- * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f
5
- */
6
1
  export declare type IsWhole<N extends number, Then = true, Else = false> = number extends N ? Else : `${N}` extends `${number}.${number}` ? Else : Then;
@@ -9,7 +9,4 @@ export declare namespace Subtract {
9
9
  type DigitArray<R extends number[], A extends number[], B extends number[]> = A['length'] extends 0 ? R : DigitArray<[...R, Digit<A[0], B[0]>], Tail<A>, Tail<B>>;
10
10
  type Digit<A extends number, B extends number> = Digit.ToTuple[A] extends [...(infer U), ...Digit.ToTuple[B]] ? U['length'] : never;
11
11
  }
12
- /**
13
- * A - 1
14
- */
15
12
  export declare type Decrement<A extends number, Fail = never> = Subtract<A, 1, Fail>;
@@ -22,9 +22,4 @@ export declare type SystemErrors = {
22
22
  'ETIMEDOUT': Error;
23
23
  };
24
24
  export declare type SystemErrorCodes = keyof SystemErrors;
25
- /**
26
- * Type guard NodeJS SystemErrors.
27
- * The list is not complete. Will add as needed.
28
- * Feel free to contribute.
29
- */
30
25
  export declare function isSystemError<C extends SystemErrorCodes>(code: C, err: unknown): err is SystemErrors[C];
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isSystemError = void 0;
4
- /**
5
- * Type guard NodeJS SystemErrors.
6
- * The list is not complete. Will add as needed.
7
- * Feel free to contribute.
8
- */
9
4
  function isSystemError(code, err) {
10
5
  return !!err && err.code === code;
11
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"isNodeError.js","sourceRoot":"","sources":["../../ts/nodejs/isNodeError.ts"],"names":[],"mappings":";;;AAmBA;;;;GAIG;AACH,SAAgB,aAAa,CAA6B,IAAO,EAAE,GAAY;IAC7E,OAAO,CAAC,CAAC,GAAG,IAAK,GAAW,CAAC,IAAI,KAAK,IAAI,CAAA;AAC5C,CAAC;AAFD,sCAEC"}
1
+ {"version":3,"file":"isNodeError.js","sourceRoot":"","sources":["../../ts/nodejs/isNodeError.ts"],"names":[],"mappings":";;;AAwBA,SAAgB,aAAa,CAA6B,IAAO,EAAE,GAAY;IAC7E,OAAO,CAAC,CAAC,GAAG,IAAK,GAAW,CAAC,IAAI,KAAK,IAAI,CAAA;AAC5C,CAAC;AAFD,sCAEC"}
@@ -1,20 +1,10 @@
1
1
  import { Widen } from '../utils';
2
2
  import { typeSym, valueSym } from './types';
3
- /**
4
- * Create a "branded" version of a type.
5
- * TypeScript won't allow implicit conversion to this type
6
- */
7
3
  export declare type Brand<B extends string, T> = T extends undefined | null | number | bigint | boolean ? {
8
4
  [typeSym]: B;
9
5
  [valueSym]: T;
10
6
  } : T & {
11
7
  [typeSym]: B;
12
8
  };
13
- /**
14
- * Creates a brand creator with the specified type.
15
- */
16
9
  export declare function brand<B extends string>(type: B): <T>(subject: T) => Brand<B, Widen<T>>;
17
- /**
18
- * Creates a branded value of specified type.
19
- */
20
10
  export declare function brand<B extends string, T>(type: B, subject: T): Brand<B, Widen<T>>;
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- // By Drew Colthorp, <https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/#comment-604580>
3
- // <https://gist.github.com/dcolthorp/aa21cf87d847ae9942106435bf47565d>
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.brand = void 0;
6
4
  var types_1 = require("./types");
@@ -8,7 +6,6 @@ function brand(type, subject) {
8
6
  if (subject === undefined)
9
7
  return function (subject) { return brand(type, subject); };
10
8
  if (typeof subject === 'object' && subject !== null) {
11
- // if subject is not an object, the branding will exist only in type-level.
12
9
  subject[types_1.typeSym] = type;
13
10
  }
14
11
  return subject;
@@ -1 +1 @@
1
- {"version":3,"file":"Brand.js","sourceRoot":"","sources":["../../ts/nominal-types/Brand.ts"],"names":[],"mappings":";AAAA,kHAAkH;AAClH,uEAAuE;;;AAGvE,iCAA2C;AAmB3C,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAiB;IACnD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,UAAa,OAAU,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA,CAAC,CAAC,CAAA;IAE1F,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QACnD,2EAA2E;QAC1E,OAAiC,CAAC,eAAO,CAAC,GAAG,IAAI,CAAA;KACnD;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AARD,sBAQC"}
1
+ {"version":3,"file":"Brand.js","sourceRoot":"","sources":["../../ts/nominal-types/Brand.ts"],"names":[],"mappings":";;;AAIA,iCAA2C;AAmB3C,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAiB;IACnD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,UAAa,OAAU,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA,CAAC,CAAC,CAAA;IAE1F,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QAElD,OAAiC,CAAC,eAAO,CAAC,GAAG,IAAI,CAAA;KACnD;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AARD,sBAQC"}
@@ -1,19 +1,7 @@
1
1
  import { Widen } from '../utils';
2
2
  import { typeSym } from './types';
3
- /**
4
- * Create a "flavored" version of a type.
5
- * TypeScript will disallow mixing flavors,
6
- * but will allow unflavored values of that type to be passed in where a flavored version is expected.
7
- * This is a less restrictive form of branding.
8
- */
9
3
  export declare type Flavor<F extends string, T> = T & {
10
4
  [typeSym]?: F;
11
5
  };
12
- /**
13
- * Creates a brand creator with the specified type.
14
- */
15
6
  export declare function flavor<F extends string>(type: F): <T>(subject: T) => Flavor<F, Widen<T>>;
16
- /**
17
- * Creates a branded value of specified type.
18
- */
19
7
  export declare function flavor<F extends string, T>(type: F, subject: T): Flavor<F, Widen<T>>;
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- // By Drew Colthorp, <https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/#comment-604580>
3
- // <https://gist.github.com/dcolthorp/aa21cf87d847ae9942106435bf47565d>
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.flavor = void 0;
6
4
  var types_1 = require("./types");
@@ -8,7 +6,6 @@ function flavor(type, subject) {
8
6
  if (subject === undefined)
9
7
  return function (subject) { return flavor(type, subject); };
10
8
  if (typeof subject === 'object' && subject !== null) {
11
- // if subject is not an object, the branding will exist only in type-level.
12
9
  subject[types_1.typeSym] = type;
13
10
  }
14
11
  return subject;
@@ -1 +1 @@
1
- {"version":3,"file":"Flavor.js","sourceRoot":"","sources":["../../ts/nominal-types/Flavor.ts"],"names":[],"mappings":";AAAA,kHAAkH;AAClH,uEAAuE;;;AAGvE,iCAAiC;AAoBjC,SAAgB,MAAM,CAAC,IAAY,EAAE,OAAiB;IACpD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,UAAa,OAAU,IAAI,OAAO,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA,CAAC,CAAC,CAAA;IAC3F,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QACnD,2EAA2E;QAC1E,OAAiC,CAAC,eAAO,CAAC,GAAG,IAAI,CAAA;KACnD;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAPD,wBAOC"}
1
+ {"version":3,"file":"Flavor.js","sourceRoot":"","sources":["../../ts/nominal-types/Flavor.ts"],"names":[],"mappings":";;;AAIA,iCAAiC;AAoBjC,SAAgB,MAAM,CAAC,IAAY,EAAE,OAAiB;IACpD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,UAAa,OAAU,IAAI,OAAO,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA,CAAC,CAAC,CAAA;IAC3F,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;QAElD,OAAiC,CAAC,eAAO,CAAC,GAAG,IAAI,CAAA;KACnD;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAPD,wBAOC"}
@@ -1,6 +1,3 @@
1
- /**
2
- * Exclude type U from properties in T.
3
- */
4
1
  export declare type ExcludePropType<T extends Record<keyof any, any>, U> = {
5
2
  [k in keyof T]: Exclude<T[k], U>;
6
3
  };
@@ -1,8 +1,4 @@
1
1
  import { And, Not } from '../predicates';
2
2
  import { AnyRecord } from './AnyRecord';
3
3
  import { HasKey } from './hasKey';
4
- /**
5
- * Are the two records disjoint from each other.
6
- * Disjoint means no common property.
7
- */
8
4
  export declare type IsDisjoint<A extends AnyRecord, B extends AnyRecord> = And<Not<HasKey<A, keyof B>>, Not<HasKey<B, keyof A>>>;
@@ -1,6 +1 @@
1
- /**
2
- * Type of all keys.
3
- * To get the keys of an object or array, use the `keyof` keyword.
4
- * This is just a convenient type as `keyof any` is not obvious.
5
- */
6
1
  export declare type KeyTypes = keyof any;
@@ -1,5 +1,2 @@
1
- /**
2
- * @deprecated renamed to `KeysOfOptional`
3
- */
4
1
  export declare type KeyofOptional<T> = T extends Record<infer U, any> ? U : never;
5
2
  export declare type KeysOfOptional<T> = T extends Record<infer U, any> ? U : never;
@@ -1,6 +1,3 @@
1
1
  "use strict";
2
- // Original by Klaus Meinhardt @ajafff
3
- // known from Gerrit Birkeland @Gerrit0
4
- // https://github.com/Microsoft/TypeScript/issues/25987#issuecomment-408339599
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  //# sourceMappingURL=KnownKeys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnownKeys.js","sourceRoot":"","sources":["../../ts/object/KnownKeys.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,uCAAuC;AACvC,8EAA8E"}
1
+ {"version":3,"file":"KnownKeys.js","sourceRoot":"","sources":["../../ts/object/KnownKeys.ts"],"names":[],"mappings":""}
@@ -1,15 +1,6 @@
1
1
  import { UnionKeys } from '../UnionKeys';
2
2
  import { Omit } from './omit';
3
3
  import { Pick } from './pick';
4
- /**
5
- * Apply `Partial<>` on the selected properties.
6
- */
7
4
  export declare type PartialPick<T, U extends UnionKeys<T>> = T extends T ? Omit<T, U> & Partial<Pick<T, U>> : never;
8
- /**
9
- * @deprecated replaced by `PartialOmit`
10
- */
11
5
  export declare type PartialExcept<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Omit<T, U>> : never;
12
- /**
13
- * Apply `Partial<>` on all not selected properties.
14
- */
15
6
  export declare type PartialOmit<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Omit<T, U>> : never;
@@ -1,15 +1,4 @@
1
1
  import { AnyRecord } from './AnyRecord';
2
- /**
3
- * Intersect type recursively.
4
- * The recursion terminates at level 7 due to design limit of TypeScript.
5
- *
6
- * Normal use case is intersecting betwee two object types.
7
- * While it works for value types and top level array,
8
- * top level array does not recursive into the elements.
9
- * NOTE: in latest TypeScript,
10
- * `undefined` is not an accepted value.
11
- * The resulting type would be `never`
12
- */
13
2
  export declare type RecursiveIntersect<T, U> = (T & (T extends Array<infer Y> ? Array<Y & U> & U : T extends AnyRecord ? {
14
3
  [P in keyof T]: T[P] extends Array<infer R> ? Array<RecursiveIntersect<R, U>> & U : T[P] extends AnyRecord ? RecursiveIntersect<T[P], U> : T[P] & U;
15
4
  } & U : U));
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
- // Thanks [jack-williams](https://github.com/jack-williams) for the [solution](https://github.com/Microsoft/TypeScript/issues/29269#issuecomment-451602962)
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  //# sourceMappingURL=Required.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Required.js","sourceRoot":"","sources":["../../ts/object/Required.ts"],"names":[],"mappings":";AAAA,2JAA2J"}
1
+ {"version":3,"file":"Required.js","sourceRoot":"","sources":["../../ts/object/Required.ts"],"names":[],"mappings":""}
@@ -1,7 +1,4 @@
1
1
  import { AnyRecord } from './AnyRecord';
2
- /**
3
- * creates a facade of the subject.
4
- */
5
2
  export declare function facade<T extends AnyRecord, P1 extends keyof T>(subject: T, prop1: P1): Pick<T, P1>;
6
3
  export declare function facade<T extends AnyRecord, P1 extends keyof T, P2 extends keyof T>(subject: T, prop1: P1, prop2: P2): Pick<T, P1 | P2>;
7
4
  export declare function facade<T extends AnyRecord, P1 extends keyof T, P2 extends keyof T, P3 extends keyof T>(subject: T, prop1: P1, prop2: P2, prop3: P3): Pick<T, P1 | P2 | P3>;