type-plus 7.0.1 → 7.1.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.
Files changed (230) hide show
  1. package/README.md +4 -34
  2. package/cjs/any/any_type.d.ts +17 -7
  3. package/cjs/any/any_type.d.ts.map +1 -1
  4. package/cjs/array/array.some.d.ts +6 -2
  5. package/cjs/array/array.some.d.ts.map +1 -1
  6. package/cjs/array/array_plus.split_at.d.ts +1 -1
  7. package/cjs/array/array_plus.split_at.d.ts.map +1 -1
  8. package/cjs/array/reduce_while.js.map +1 -1
  9. package/cjs/assertion/assert_type.d.ts +3 -3
  10. package/cjs/assertion/assert_type.d.ts.map +1 -1
  11. package/cjs/assertion/assert_type.js +6 -3
  12. package/cjs/assertion/assert_type.js.map +1 -1
  13. package/cjs/bigint/bigint_type.d.ts +1 -1
  14. package/cjs/bigint/bigint_type.d.ts.map +1 -1
  15. package/cjs/bigint/strict_bigint_type.d.ts +1 -1
  16. package/cjs/bigint/strict_bigint_type.d.ts.map +1 -1
  17. package/cjs/binary/index.js +2 -25
  18. package/cjs/binary/index.js.map +1 -1
  19. package/cjs/boolean/boolean_type.d.ts +1 -1
  20. package/cjs/boolean/boolean_type.d.ts.map +1 -1
  21. package/cjs/boolean/false_type.d.ts +1 -1
  22. package/cjs/boolean/false_type.d.ts.map +1 -1
  23. package/cjs/boolean/strict_boolean_type.d.ts +1 -1
  24. package/cjs/boolean/strict_boolean_type.d.ts.map +1 -1
  25. package/cjs/boolean/true_type.d.ts +1 -1
  26. package/cjs/boolean/true_type.d.ts.map +1 -1
  27. package/cjs/equal/equal.d.ts +18 -18
  28. package/cjs/function/function_type.d.ts +1 -1
  29. package/cjs/function/function_type.d.ts.map +1 -1
  30. package/cjs/function/strict_function_type.d.ts +1 -1
  31. package/cjs/function/strict_function_type.d.ts.map +1 -1
  32. package/cjs/functional/context.js.map +1 -1
  33. package/cjs/index.d.ts +2 -2
  34. package/cjs/index.d.ts.map +1 -1
  35. package/cjs/index.js +7 -22
  36. package/cjs/index.js.map +1 -1
  37. package/cjs/mix_types/any_or_never_type.d.ts +29 -0
  38. package/cjs/mix_types/any_or_never_type.d.ts.map +1 -0
  39. package/cjs/{object/RecursivePartial.js → mix_types/any_or_never_type.js} +1 -1
  40. package/cjs/mix_types/any_or_never_type.js.map +1 -0
  41. package/cjs/number/number_type.d.ts +1 -1
  42. package/cjs/number/number_type.d.ts.map +1 -1
  43. package/cjs/numeric/integer.d.ts +1 -1
  44. package/cjs/numeric/integer.d.ts.map +1 -1
  45. package/cjs/numeric/numeric_type.d.ts +1 -1
  46. package/cjs/numeric/numeric_type.d.ts.map +1 -1
  47. package/cjs/object/ANotB.d.ts +3 -2
  48. package/cjs/object/ANotB.d.ts.map +1 -1
  49. package/cjs/object/Required.d.ts +1 -1
  50. package/cjs/object/Required.d.ts.map +1 -1
  51. package/cjs/object/findKey.d.ts +1 -1
  52. package/cjs/object/findKey.d.ts.map +1 -1
  53. package/cjs/object/forEachKey.d.ts +1 -1
  54. package/cjs/object/forEachKey.d.ts.map +1 -1
  55. package/cjs/object/hasProperty.d.ts +1 -1
  56. package/cjs/object/hasProperty.d.ts.map +1 -1
  57. package/cjs/object/index.d.ts +1 -1
  58. package/cjs/object/index.d.ts.map +1 -1
  59. package/cjs/object/object_type.d.ts +1 -1
  60. package/cjs/object/object_type.d.ts.map +1 -1
  61. package/cjs/object/recursive_partial.d.ts +29 -0
  62. package/cjs/object/recursive_partial.d.ts.map +1 -0
  63. package/cjs/object/recursive_partial.js +4 -0
  64. package/cjs/object/recursive_partial.js.map +1 -0
  65. package/cjs/object/split.d.ts +1 -1
  66. package/cjs/object/split.d.ts.map +1 -1
  67. package/cjs/package.json +3 -1
  68. package/cjs/primitive.d.ts +3 -0
  69. package/cjs/primitive.d.ts.map +1 -1
  70. package/cjs/string/string_type.d.ts +1 -1
  71. package/cjs/string/string_type.d.ts.map +1 -1
  72. package/cjs/symbol/symbol_type.d.ts +1 -1
  73. package/cjs/symbol/symbol_type.d.ts.map +1 -1
  74. package/cjs/testing/stub.d.ts +4 -1
  75. package/cjs/testing/stub.d.ts.map +1 -1
  76. package/cjs/testing/stub.js.map +1 -1
  77. package/cjs/type/failed.d.ts +1 -1
  78. package/cjs/type/failed.d.ts.map +1 -1
  79. package/cjs/type/no_infer.d.ts +9 -6
  80. package/cjs/type/no_infer.d.ts.map +1 -1
  81. package/cjs/type-guard/is_type.d.ts +1 -1
  82. package/cjs/type-guard/is_type.js +1 -1
  83. package/cjs/type-guard/is_type.js.map +1 -1
  84. package/cjs/unpartial.d.ts +2 -0
  85. package/cjs/unpartial.d.ts.map +1 -0
  86. package/cjs/unpartial.js +8 -0
  87. package/cjs/unpartial.js.map +1 -0
  88. package/cjs/void/void_type.d.ts +1 -1
  89. package/cjs/void/void_type.d.ts.map +1 -1
  90. package/esm/any/any_type.d.ts +17 -7
  91. package/esm/any/any_type.d.ts.map +1 -1
  92. package/esm/array/array.some.d.ts +6 -2
  93. package/esm/array/array.some.d.ts.map +1 -1
  94. package/esm/array/array_plus.split_at.d.ts +1 -1
  95. package/esm/array/array_plus.split_at.d.ts.map +1 -1
  96. package/esm/array/reduce_while.js.map +1 -1
  97. package/esm/assertion/assert_type.d.ts +3 -3
  98. package/esm/assertion/assert_type.d.ts.map +1 -1
  99. package/esm/assertion/assert_type.js +7 -3
  100. package/esm/assertion/assert_type.js.map +1 -1
  101. package/esm/bigint/bigint_type.d.ts +1 -1
  102. package/esm/bigint/bigint_type.d.ts.map +1 -1
  103. package/esm/bigint/strict_bigint_type.d.ts +1 -1
  104. package/esm/bigint/strict_bigint_type.d.ts.map +1 -1
  105. package/esm/boolean/boolean_type.d.ts +1 -1
  106. package/esm/boolean/boolean_type.d.ts.map +1 -1
  107. package/esm/boolean/false_type.d.ts +1 -1
  108. package/esm/boolean/false_type.d.ts.map +1 -1
  109. package/esm/boolean/strict_boolean_type.d.ts +1 -1
  110. package/esm/boolean/strict_boolean_type.d.ts.map +1 -1
  111. package/esm/boolean/true_type.d.ts +1 -1
  112. package/esm/boolean/true_type.d.ts.map +1 -1
  113. package/esm/equal/equal.d.ts +18 -18
  114. package/esm/function/function_type.d.ts +1 -1
  115. package/esm/function/function_type.d.ts.map +1 -1
  116. package/esm/function/strict_function_type.d.ts +1 -1
  117. package/esm/function/strict_function_type.d.ts.map +1 -1
  118. package/esm/functional/context.js.map +1 -1
  119. package/esm/index.d.ts +2 -2
  120. package/esm/index.d.ts.map +1 -1
  121. package/esm/index.js +1 -1
  122. package/esm/index.js.map +1 -1
  123. package/esm/mix_types/any_or_never_type.d.ts +29 -0
  124. package/esm/mix_types/any_or_never_type.d.ts.map +1 -0
  125. package/esm/mix_types/any_or_never_type.js +2 -0
  126. package/esm/mix_types/any_or_never_type.js.map +1 -0
  127. package/esm/number/number_type.d.ts +1 -1
  128. package/esm/number/number_type.d.ts.map +1 -1
  129. package/esm/numeric/integer.d.ts +1 -1
  130. package/esm/numeric/integer.d.ts.map +1 -1
  131. package/esm/numeric/numeric_type.d.ts +1 -1
  132. package/esm/numeric/numeric_type.d.ts.map +1 -1
  133. package/esm/object/ANotB.d.ts +3 -2
  134. package/esm/object/ANotB.d.ts.map +1 -1
  135. package/esm/object/Required.d.ts +1 -1
  136. package/esm/object/Required.d.ts.map +1 -1
  137. package/esm/object/findKey.d.ts +1 -1
  138. package/esm/object/findKey.d.ts.map +1 -1
  139. package/esm/object/forEachKey.d.ts +1 -1
  140. package/esm/object/forEachKey.d.ts.map +1 -1
  141. package/esm/object/hasProperty.d.ts +1 -1
  142. package/esm/object/hasProperty.d.ts.map +1 -1
  143. package/esm/object/index.d.ts +1 -1
  144. package/esm/object/index.d.ts.map +1 -1
  145. package/esm/object/object_type.d.ts +1 -1
  146. package/esm/object/object_type.d.ts.map +1 -1
  147. package/esm/object/recursive_partial.d.ts +29 -0
  148. package/esm/object/recursive_partial.d.ts.map +1 -0
  149. package/esm/object/recursive_partial.js +3 -0
  150. package/esm/object/recursive_partial.js.map +1 -0
  151. package/esm/object/split.d.ts +1 -1
  152. package/esm/object/split.d.ts.map +1 -1
  153. package/esm/primitive.d.ts +3 -0
  154. package/esm/primitive.d.ts.map +1 -1
  155. package/esm/string/string_type.d.ts +1 -1
  156. package/esm/string/string_type.d.ts.map +1 -1
  157. package/esm/symbol/symbol_type.d.ts +1 -1
  158. package/esm/symbol/symbol_type.d.ts.map +1 -1
  159. package/esm/testing/stub.d.ts +4 -1
  160. package/esm/testing/stub.d.ts.map +1 -1
  161. package/esm/testing/stub.js.map +1 -1
  162. package/esm/type/failed.d.ts +1 -1
  163. package/esm/type/failed.d.ts.map +1 -1
  164. package/esm/type/no_infer.d.ts +9 -6
  165. package/esm/type/no_infer.d.ts.map +1 -1
  166. package/esm/type-guard/is_type.d.ts +1 -1
  167. package/esm/type-guard/is_type.js +1 -1
  168. package/esm/type-guard/is_type.js.map +1 -1
  169. package/esm/unpartial.d.ts +2 -0
  170. package/esm/unpartial.d.ts.map +1 -0
  171. package/esm/unpartial.js +2 -0
  172. package/esm/unpartial.js.map +1 -0
  173. package/esm/void/void_type.d.ts +1 -1
  174. package/esm/void/void_type.d.ts.map +1 -1
  175. package/package.json +17 -28
  176. package/ts/any/any_type.ts +17 -7
  177. package/ts/array/array.some.ts +18 -4
  178. package/ts/array/array_plus.split_at.ts +1 -1
  179. package/ts/array/reduce_while.ts +1 -1
  180. package/ts/assertion/assert_type.ts +7 -4
  181. package/ts/bigint/bigint_type.ts +1 -1
  182. package/ts/bigint/strict_bigint_type.ts +1 -1
  183. package/ts/boolean/boolean_type.ts +1 -1
  184. package/ts/boolean/false_type.ts +1 -1
  185. package/ts/boolean/strict_boolean_type.ts +1 -1
  186. package/ts/boolean/true_type.ts +1 -1
  187. package/ts/equal/equal.ts +18 -18
  188. package/ts/function/function_type.ts +1 -1
  189. package/ts/function/strict_function_type.ts +1 -1
  190. package/ts/functional/context.ts +1 -1
  191. package/ts/index.ts +3 -2
  192. package/ts/mix_types/any_or_never_type.ts +30 -0
  193. package/ts/number/number_type.ts +1 -1
  194. package/ts/numeric/integer.ts +1 -1
  195. package/ts/numeric/numeric_type.ts +1 -1
  196. package/ts/object/ANotB.ts +2 -1
  197. package/ts/object/Required.ts +1 -1
  198. package/ts/object/findKey.ts +1 -1
  199. package/ts/object/forEachKey.ts +1 -1
  200. package/ts/object/hasProperty.ts +1 -1
  201. package/ts/object/index.ts +1 -1
  202. package/ts/object/object_type.ts +1 -1
  203. package/ts/object/recursive_partial.ts +39 -0
  204. package/ts/object/split.ts +1 -1
  205. package/ts/primitive.ts +3 -0
  206. package/ts/string/string_type.ts +1 -1
  207. package/ts/symbol/symbol_type.ts +1 -1
  208. package/ts/testing/stub.ts +4 -1
  209. package/ts/type/failed.ts +1 -1
  210. package/ts/type/no_infer.ts +9 -6
  211. package/ts/type-guard/is_type.ts +2 -2
  212. package/ts/unpartial.ts +1 -0
  213. package/ts/void/void_type.ts +1 -1
  214. package/cjs/any/any_or_never.d.ts +0 -15
  215. package/cjs/any/any_or_never.d.ts.map +0 -1
  216. package/cjs/any/any_or_never.js +0 -3
  217. package/cjs/any/any_or_never.js.map +0 -1
  218. package/cjs/object/RecursivePartial.d.ts +0 -5
  219. package/cjs/object/RecursivePartial.d.ts.map +0 -1
  220. package/cjs/object/RecursivePartial.js.map +0 -1
  221. package/esm/any/any_or_never.d.ts +0 -15
  222. package/esm/any/any_or_never.d.ts.map +0 -1
  223. package/esm/any/any_or_never.js +0 -2
  224. package/esm/any/any_or_never.js.map +0 -1
  225. package/esm/object/RecursivePartial.d.ts +0 -5
  226. package/esm/object/RecursivePartial.d.ts.map +0 -1
  227. package/esm/object/RecursivePartial.js +0 -2
  228. package/esm/object/RecursivePartial.js.map +0 -1
  229. package/ts/any/any_or_never.ts +0 -15
  230. package/ts/object/RecursivePartial.ts +0 -10
@@ -0,0 +1,30 @@
1
+ import type { IsNever } from '../never/never_type.js'
2
+ import type { IsAny } from '../any/any_type.js'
3
+
4
+ /**
5
+ * 🐾 Parse `T` to ensure it is either exactly `any` or exactly `never`.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * type R = AnyType<any> // any
10
+ *
11
+ * type R = AnyType<never> // never
12
+ * type R = AnyType<unknown> // never
13
+ * type R = AnyType<string | boolean> // never
14
+ * ```
15
+ */
16
+ export type AnyOrNeverType<T, Then = T, Else = never> = IsNever<T, Then, IsAny<T, Then, Else>>
17
+
18
+ /**
19
+ * 🎭 Validate if `T` is either exactly `any` or exactly `never`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * type R = IsAnyOrNever<any> // true
24
+ * type R = IsAnyOrNever<never> // true
25
+ *
26
+ * type R = IsAnyOrNever<1> // false
27
+ * type R = IsAnyOrNever<unknown> // false
28
+ * ```
29
+ */
30
+ export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is `number`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
  import type { Numeric } from './numeric_type.js'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Either number or bigint.
@@ -2,6 +2,7 @@ import type { IsEqual } from '../equal/equal.js'
2
2
  import type { AnyRecord } from './AnyRecord.js'
3
3
  import type { IsDisjoint } from './IsDisjoint.js'
4
4
  import type { KeysWithDiffType } from './KeysWithDiffType.js'
5
+ import type { Properties } from './properties.js'
5
6
 
6
7
  export type ANotB<A extends AnyRecord, B extends AnyRecord> = IsEqual<A, B> extends true
7
8
  ? never
@@ -15,4 +16,4 @@ export type LeftJoin<A extends AnyRecord, B extends AnyRecord> = IsEqual<A, B> e
15
16
  ? A
16
17
  : IsDisjoint<A, B> extends true
17
18
  ? A & B
18
- : { [k in Exclude<keyof A, keyof B>]: A[k] } & { [k in keyof B]: B[k] }
19
+ : Properties<{ [k in Exclude<keyof A, keyof B>]: A[k] } & { [k in keyof B]: B[k] }>
@@ -1,6 +1,6 @@
1
1
  // Thanks [jack-williams](https://github.com/jack-williams) for the [solution](https://github.com/Microsoft/TypeScript/issues/29269#issuecomment-451602962)
2
2
 
3
- import { NonUndefined } from '../utils/NonUndefined.js'
3
+ import type { NonUndefined } from '../utils/NonUndefined.js'
4
4
 
5
5
  export type Required<T> = { [P in keyof T]-?: NonUndefined<T[P]> }
6
6
 
@@ -1,4 +1,4 @@
1
- import { KeyTypes } from './KeyTypes.js'
1
+ import type { KeyTypes } from './KeyTypes.js'
2
2
 
3
3
  export function findKey<S extends Record<KeyTypes, any>, T = any>(
4
4
  subject: S,
@@ -1,4 +1,4 @@
1
- import { KeyTypes } from './KeyTypes.js'
1
+ import type { KeyTypes } from './KeyTypes.js'
2
2
 
3
3
  export function forEachKey<S extends Record<KeyTypes, any>, T = any>(
4
4
  subject: S,
@@ -1,4 +1,4 @@
1
- import { UnionKeys } from '../union_keys.js'
1
+ import type { UnionKeys } from '../union_keys.js'
2
2
 
3
3
  export function hasProperty<T, P extends UnionKeys<T>>(value: T, prop: P): value is T & Record<P, T[P]> {
4
4
  return !!value[prop]
@@ -10,7 +10,7 @@ export type { KnownKeys } from './KnownKeys.js'
10
10
  export type { OptionalKeys } from './OptionalKeys.js'
11
11
  export type { Partial, PartialExcept, PartialOmit, PartialPick } from './Partial.js'
12
12
  export type { RecursiveIntersect } from './RecursiveIntersect.js'
13
- export type { RecursivePartial } from './RecursivePartial.js'
13
+ export type { RecursivePartial } from './recursive_partial.js'
14
14
  export type { RecursiveRequired } from './RecursiveRequired.js'
15
15
  export type { RequiredExcept, RequiredPick } from './Required.js'
16
16
  export type { RequiredKeys } from './RequiredKeys.js'
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if `T` is an `object`.
@@ -0,0 +1,39 @@
1
+ // Source: https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript-2-1
2
+
3
+ import type { AnyFunction } from '../function/any_function.js'
4
+ import type { ExtractFunction } from '../index.js'
5
+ import type { AnyRecord } from './AnyRecord.js'
6
+ import type { Properties } from './properties.js'
7
+
8
+ /**
9
+ * Creates a recursive partial type of type T.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * interface Foo {
14
+ * bar: number;
15
+ * baz: {
16
+ * qux: string
17
+ * }
18
+ * }
19
+ *
20
+ * type PartialFoo = RecursivePartial<Foo>
21
+ * // {
22
+ * // bar?: number | undefined;
23
+ * // baz?: {
24
+ * // qux?: string | undefined
25
+ * // } | undefined
26
+ * // }
27
+ * ```
28
+ */
29
+ export type RecursivePartial<T> = {
30
+ [P in keyof T]?: T[P] extends (infer U)[]
31
+ ? RecursivePartial<U>[] | undefined
32
+ : T[P] extends infer F extends AnyFunction
33
+ ? [keyof T[P]] extends [undefined]
34
+ ? T[P] | undefined
35
+ : ExtractFunction<F> & RecursivePartial<Properties<T[P]>>
36
+ : T[P] extends AnyRecord
37
+ ? RecursivePartial<T[P]> | undefined
38
+ : T[P] | undefined
39
+ }
@@ -3,7 +3,7 @@ import type { AnyRecord } from './AnyRecord.js'
3
3
  import type { Omit } from './omit.js'
4
4
  import { reduceByKey } from './reduceKey.js'
5
5
  import type { Partial } from './Partial.js'
6
- import { NonUndefined } from '../utils/NonUndefined.js'
6
+ import type { NonUndefined } from '../utils/NonUndefined.js'
7
7
 
8
8
  type Splitter<T extends AnyRecord> = Partial<{ [k in keyof T]: T[k] | undefined }>
9
9
  export type Split<T extends AnyRecord, S extends AnyRecord> = {
package/ts/primitive.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * 📘 Definition of all primitive types.
3
+ */
1
4
  export type PrimitiveTypes =
2
5
  | boolean
3
6
  | number
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is `string` or string literals.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `symbol`.
@@ -1,11 +1,14 @@
1
1
  import { requiredDeep } from 'unpartial'
2
2
  import type { AnyFunction } from '../function/any_function.js'
3
- import type { RecursivePartial } from '../object/RecursivePartial.js'
3
+ import type { RecursivePartial } from '../object/recursive_partial.js'
4
4
  import type { NoInfer } from '../type/no_infer.js'
5
5
 
6
6
  /**
7
7
  * stub a value.
8
+ *
8
9
  * If the value is a function, it will be passed through as-is.
10
+ *
11
+ * 🦴 `utilities`
9
12
  */
10
13
  export function stub<T extends AnyFunction>(stub: T): T
11
14
  export function stub<T>(stub: RecursivePartial<NoInfer<T>>): T
package/ts/type/failed.ts CHANGED
@@ -27,6 +27,6 @@ export interface Failed<Msg extends string> {
27
27
  *
28
28
  * It's recommended to create custom failed types instead of using this to provide better message.
29
29
  */
30
- export interface FailedT<Msg extends string, T> {
30
+ export interface FailedT<Msg extends string, _T> {
31
31
  [uniSym]: Msg
32
32
  }
@@ -1,14 +1,14 @@
1
- import { IsNull } from '../null/null_type.js'
2
- import { Or } from '../predicates/logical.js'
3
- import { IsUndefined } from '../undefined/undefined_type.js'
1
+ import type { IsNull } from '../null/null_type.js'
2
+ import type { Or } from '../predicates/logical.js'
3
+ import type { IsUndefined } from '../undefined/undefined_type.js'
4
4
 
5
5
  /**
6
6
  * Prevents inference of a type parameter `T`.
7
7
  *
8
- * A build-in type `NoInfer` is coming soon.
9
- * @see https://github.com/microsoft/TypeScript/pull/52968
8
+ * 🦴 *utilities*
10
9
  *
11
- * @by @ajafff
10
+ * @ajafff original version author
11
+ * @see https://github.com/microsoft/TypeScript/issues/14829#issuecomment-298425341
12
12
  *
13
13
  * @example
14
14
  * ```ts
@@ -20,5 +20,8 @@ import { IsUndefined } from '../undefined/undefined_type.js'
20
20
  * assertEqual(123, 'abc') // Error
21
21
  * assertEqual({ x: 1 }, { x: 1, y: 2 }) // Error
22
22
  * ```
23
+ *
24
+ * A build-in `NoInfer` is coming soon.
25
+ * @see https://github.com/microsoft/TypeScript/pull/52968
23
26
  */
24
27
  export type NoInfer<T> = Or<IsNull<T>, IsUndefined<T>, T, T & {}>
@@ -36,7 +36,7 @@ function isNever<S extends never>(): unknown
36
36
  * @deprecated use `isType<T>()` or `testType.never<T>()` instead
37
37
  */
38
38
  function isNever(subject: never): subject is never
39
- function isNever(subject?: unknown): subject is never {
39
+ function isNever(_subject?: unknown): _subject is never {
40
40
  return true
41
41
  }
42
42
 
@@ -49,4 +49,4 @@ isType.never = isNever
49
49
  *
50
50
  * @deprecated use `testType.equal()` instead
51
51
  */
52
- isType.equal = function <C extends IsEqual<A, B>, A, B>() {}
52
+ isType.equal = function <_C extends IsEqual<A, B>, A, B>() {}
@@ -0,0 +1 @@
1
+ export { required, requiredDeep, unpartial } from 'unpartial'
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
  import type { IsUndefined } from '../undefined/undefined_type.js'
3
3
 
4
4
  /**
@@ -1,15 +0,0 @@
1
- import type { IsNever } from '../never/never_type.js';
2
- import type { IsAny } from './any_type.js';
3
- /**
4
- * Is `T` type `any` or `never`.
5
- *
6
- * ```ts
7
- * type R = IsAnyOrNever<any> // true
8
- * type R = IsAnyOrNever<never> // true
9
- *
10
- * type R = IsAnyOrNever<1> // false
11
- * type R = IsAnyOrNever<unknown> // false
12
- * ```
13
- */
14
- export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>;
15
- //# sourceMappingURL=any_or_never.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"any_or_never.d.ts","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=any_or_never.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"any_or_never.js","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import type { AnyRecord } from './AnyRecord.js';
2
- export type RecursivePartial<T> = {
3
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends AnyRecord ? RecursivePartial<T[P]> : T[P];
4
- };
5
- //# sourceMappingURL=RecursivePartial.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecursivePartial.d.ts","sourceRoot":"","sources":["../../ts/object/RecursivePartial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACtC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GACrB,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtB,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACtB,CAAC,CAAC,CAAC,CAAC;CACP,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecursivePartial.js","sourceRoot":"","sources":["../../ts/object/RecursivePartial.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import type { IsNever } from '../never/never_type.js';
2
- import type { IsAny } from './any_type.js';
3
- /**
4
- * Is `T` type `any` or `never`.
5
- *
6
- * ```ts
7
- * type R = IsAnyOrNever<any> // true
8
- * type R = IsAnyOrNever<never> // true
9
- *
10
- * type R = IsAnyOrNever<1> // false
11
- * type R = IsAnyOrNever<unknown> // false
12
- * ```
13
- */
14
- export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>;
15
- //# sourceMappingURL=any_or_never.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"any_or_never.d.ts","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=any_or_never.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"any_or_never.js","sourceRoot":"","sources":["../../ts/any/any_or_never.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import type { AnyRecord } from './AnyRecord.js';
2
- export type RecursivePartial<T> = {
3
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends AnyRecord ? RecursivePartial<T[P]> : T[P];
4
- };
5
- //# sourceMappingURL=RecursivePartial.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecursivePartial.d.ts","sourceRoot":"","sources":["../../ts/object/RecursivePartial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACtC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GACrB,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GACtB,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACtB,CAAC,CAAC,CAAC,CAAC;CACP,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RecursivePartial.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RecursivePartial.js","sourceRoot":"","sources":["../../ts/object/RecursivePartial.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import type { IsNever } from '../never/never_type.js'
2
- import type { IsAny } from './any_type.js'
3
-
4
- /**
5
- * Is `T` type `any` or `never`.
6
- *
7
- * ```ts
8
- * type R = IsAnyOrNever<any> // true
9
- * type R = IsAnyOrNever<never> // true
10
- *
11
- * type R = IsAnyOrNever<1> // false
12
- * type R = IsAnyOrNever<unknown> // false
13
- * ```
14
- */
15
- export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>
@@ -1,10 +0,0 @@
1
- import type { AnyRecord } from './AnyRecord.js'
2
-
3
- // Source: https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript-2-1
4
- export type RecursivePartial<T> = {
5
- [P in keyof T]?: T[P] extends (infer U)[]
6
- ? RecursivePartial<U>[]
7
- : T[P] extends AnyRecord
8
- ? RecursivePartial<T[P]>
9
- : T[P]
10
- }