umt 2.20.0 → 3.1.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 (71) hide show
  1. package/module/Date/getDay.d.ts +1 -2
  2. package/module/Object/keyBy.d.ts +3 -4
  3. package/module/Validate/array/arrayOf.d.ts +8 -6
  4. package/module/Validate/array/arrayOf.js +2 -3
  5. package/module/Validate/array/arrayOf.js.map +1 -1
  6. package/module/Validate/array/index.d.ts +0 -1
  7. package/module/Validate/array/index.js +0 -1
  8. package/module/Validate/array/index.js.map +1 -1
  9. package/module/Validate/function/core.d.ts +9 -10
  10. package/module/Validate/function/core.js.map +1 -1
  11. package/module/Validate/instanceof/core.d.ts +1 -2
  12. package/module/Validate/map/core.d.ts +2 -3
  13. package/module/Validate/map/core.js.map +1 -1
  14. package/module/Validate/object/intersection.d.ts +6 -4
  15. package/module/Validate/object/intersection.js.map +1 -1
  16. package/module/Validate/object/nullable.d.ts +1 -2
  17. package/module/Validate/object/optional.d.ts +1 -2
  18. package/module/Validate/object/partial.d.ts +1 -2
  19. package/module/Validate/object/required.d.ts +2 -3
  20. package/module/Validate/object/union.d.ts +2 -3
  21. package/module/Validate/object/union.js.map +1 -1
  22. package/module/Validate/set/core.d.ts +2 -3
  23. package/module/Validate/set/core.js.map +1 -1
  24. package/module/Validate/string/oneOf.d.ts +10 -7
  25. package/module/Validate/string/oneOf.js +5 -3
  26. package/module/Validate/string/oneOf.js.map +1 -1
  27. package/module/Validate/templateLiteral/core.d.ts +5 -6
  28. package/module/Validate/templateLiteral/core.js.map +1 -1
  29. package/module/Validate/type.d.ts +14 -2
  30. package/module/es5/Date/getDay.d.ts +1 -2
  31. package/module/es5/Object/keyBy.d.ts +3 -4
  32. package/module/es5/Validate/array/arrayOf.d.ts +8 -6
  33. package/module/es5/Validate/array/arrayOf.js +10 -5
  34. package/module/es5/Validate/array/index.d.ts +0 -1
  35. package/module/es5/Validate/array/index.js +0 -11
  36. package/module/es5/Validate/function/core.d.ts +9 -10
  37. package/module/es5/Validate/function/core.js +0 -2
  38. package/module/es5/Validate/instanceof/core.d.ts +1 -2
  39. package/module/es5/Validate/map/core.d.ts +2 -3
  40. package/module/es5/Validate/object/intersection.d.ts +6 -4
  41. package/module/es5/Validate/object/intersection.js +6 -0
  42. package/module/es5/Validate/object/nullable.d.ts +1 -2
  43. package/module/es5/Validate/object/optional.d.ts +1 -2
  44. package/module/es5/Validate/object/partial.d.ts +1 -2
  45. package/module/es5/Validate/object/required.d.ts +2 -3
  46. package/module/es5/Validate/object/union.d.ts +2 -3
  47. package/module/es5/Validate/set/core.d.ts +2 -3
  48. package/module/es5/Validate/string/oneOf.d.ts +10 -7
  49. package/module/es5/Validate/string/oneOf.js +8 -6
  50. package/module/es5/Validate/templateLiteral/core.d.ts +5 -6
  51. package/module/es5/Validate/type.d.ts +14 -2
  52. package/module/es5/types/array/chunk.d.ts +1 -2
  53. package/module/es5/types/array/zip.d.ts +4 -2
  54. package/module/es5/types/logic/binary1bitNor.d.ts +1 -2
  55. package/module/es5/types/logic/binaryFullAdder.d.ts +1 -2
  56. package/module/es5/types/math/divide.d.ts +1 -2
  57. package/module/es5/types/math/multiply.d.ts +1 -2
  58. package/module/es5/types/object/pickDeep.d.ts +3 -4
  59. package/module/types/array/chunk.d.ts +1 -2
  60. package/module/types/array/zip.d.ts +4 -2
  61. package/module/types/logic/binary1bitNor.d.ts +1 -2
  62. package/module/types/logic/binaryFullAdder.d.ts +1 -2
  63. package/module/types/math/divide.d.ts +1 -2
  64. package/module/types/math/multiply.d.ts +1 -2
  65. package/module/types/object/pickDeep.d.ts +3 -4
  66. package/package.json +1 -1
  67. package/module/Validate/array/core.d.ts +0 -14
  68. package/module/Validate/array/core.js +0 -43
  69. package/module/Validate/array/core.js.map +0 -1
  70. package/module/es5/Validate/array/core.d.ts +0 -14
  71. package/module/es5/Validate/array/core.js +0 -62
@@ -1,5 +1,5 @@
1
1
  import type { ArrayToUnion } from "../types/logic/arrayToUnion";
2
- interface DayList {
2
+ export interface DayList {
3
3
  de: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
4
4
  ko: ["일", "월", "화", "수", "목", "금", "토"];
5
5
  en: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -17,4 +17,3 @@ interface DayList {
17
17
  * getDay(1, "fr"); // Returns "Lun"
18
18
  */
19
19
  export declare const getDay: <T extends keyof DayList>(day: number, lang?: T) => ArrayToUnion<DayList[T]>;
20
- export {};
@@ -1,6 +1,6 @@
1
- type PropertyName = string | number | symbol;
2
- type IterateeFunction<T> = (value: T) => PropertyName;
3
- type Iteratee<T> = IterateeFunction<T> | keyof T;
1
+ export type PropertyName = string | number | symbol;
2
+ export type IterateeFunction<T> = (value: T) => PropertyName;
3
+ export type Iteratee<T> = IterateeFunction<T> | keyof T;
4
4
  /**
5
5
  * Creates an object composed of keys generated from the results of running each element of collection through iteratee
6
6
  * @param collection The collection to iterate over
@@ -17,4 +17,3 @@ type Iteratee<T> = IterateeFunction<T> | keyof T;
17
17
  * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
18
18
  */
19
19
  export declare function keyBy<T>(collection: T[] | Record<PropertyName, T>, iteratee?: Iteratee<T>): Record<PropertyName, T>;
20
- export {};
@@ -1,14 +1,16 @@
1
- import type { ValidateCoreReturnType } from "../../Validate/type";
1
+ import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
2
+ export type ArrayOfExtractValidatedType<V> = V extends (value: never) => {
3
+ type: infer T;
4
+ } ? ValidateType<T> : never;
2
5
  /**
3
6
  * Creates an array validator that validates every element with a single validator
4
- * @template T - Element type validated by the wrapped validator
5
- * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through)
6
- * @param {Function} validator - Validator applied to each element (e.g. an object validator)
7
+ * @template V - The validator function applied to each element (its return `type` field carries the element type)
8
+ * @param {V} validator - Validator applied to each element (e.g. an object validator)
7
9
  * @param {string} [message] - Custom error message for array type validation
8
10
  * @returns {Function} - Validator function for arrays whose elements satisfy the given validator
9
11
  */
10
- export declare const arrayOf: <T, R extends {
12
+ export declare const arrayOf: <V extends (value: never) => {
11
13
  type: unknown;
12
14
  message: string;
13
15
  validate: boolean;
14
- }>(validator: (value: T) => R, message?: string) => (values: T[]) => ValidateCoreReturnType<T[]>;
16
+ }>(validator: V, message?: string) => (values: ArrayOfExtractValidatedType<V>[]) => ValidateCoreReturnType<ArrayOfExtractValidatedType<V>[]>;
@@ -1,9 +1,8 @@
1
1
  import { isArray } from "../../Validate/isArray";
2
2
  /**
3
3
  * Creates an array validator that validates every element with a single validator
4
- * @template T - Element type validated by the wrapped validator
5
- * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through)
6
- * @param {Function} validator - Validator applied to each element (e.g. an object validator)
4
+ * @template V - The validator function applied to each element (its return `type` field carries the element type)
5
+ * @param {V} validator - Validator applied to each element (e.g. an object validator)
7
6
  * @param {string} [message] - Custom error message for array type validation
8
7
  * @returns {Function} - Validator function for arrays whose elements satisfy the given validator
9
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"arrayOf.js","sourceRoot":"","sources":["../../../src/Validate/array/arrayOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAIrB,SAA0B,EAC1B,OAAgB,EAChB,EAAE;IACF,OAAO,CAAC,MAAW,EAA+B,EAAE;QAClD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"arrayOf.js","sourceRoot":"","sources":["../../../src/Validate/array/arrayOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAc7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAOrB,SAAY,EACZ,OAAgB,EAChB,EAAE;IAEF,OAAO,CAAC,MAAiB,EAAqC,EAAE;QAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,MAAM,GACV,SAID,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,2 +1 @@
1
1
  export * from "./arrayOf";
2
- export * from "./core";
@@ -1,3 +1,2 @@
1
1
  export * from "./arrayOf";
2
- export * from "./core";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Validate/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -11,27 +11,27 @@
11
11
  * the schema on every call.
12
12
  */
13
13
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
14
- type AnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
15
- type ExtractValidatedType<V> = V extends (value: never) => {
14
+ export type FunctionAnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
15
+ export type FunctionExtractValidatedType<V> = V extends (value: never) => {
16
16
  type: infer T;
17
17
  } ? ValidateType<T> : never;
18
- type InferInputs<Inputs> = Inputs extends readonly AnyValidator[] ? {
19
- [K in keyof Inputs]: ExtractValidatedType<Inputs[K]>;
18
+ export type InferInputs<Inputs> = Inputs extends readonly FunctionAnyValidator[] ? {
19
+ [K in keyof Inputs]: FunctionExtractValidatedType<Inputs[K]>;
20
20
  } : any[];
21
- type InferOutput<Output> = Output extends AnyValidator ? ExtractValidatedType<Output> : any;
21
+ export type InferOutput<Output> = Output extends FunctionAnyValidator ? FunctionExtractValidatedType<Output> : any;
22
22
  /**
23
23
  * Function schema definition. `input` describes positional parameters and
24
24
  * `output` describes the return type. Both are optional; when omitted the
25
25
  * validator only enforces that the value is callable.
26
26
  */
27
27
  export interface FunctionSchema {
28
- input?: readonly AnyValidator[];
29
- output?: AnyValidator;
28
+ input?: readonly FunctionAnyValidator[];
29
+ output?: FunctionAnyValidator;
30
30
  }
31
- type ExtractInput<S> = S extends {
31
+ export type ExtractInput<S> = S extends {
32
32
  input: infer I;
33
33
  } ? I : undefined;
34
- type ExtractOutput<S> = S extends {
34
+ export type ExtractOutput<S> = S extends {
35
35
  output: infer O;
36
36
  } ? O : undefined;
37
37
  /**
@@ -72,4 +72,3 @@ export interface FunctionValidator<Inputs, Output> {
72
72
  * @returns {FunctionValidator} - Validator augmented with `implement()`
73
73
  */
74
74
  export declare const function_: <const S extends FunctionSchema = FunctionSchema>(schema?: S, message?: string) => FunctionValidator<ExtractInput<S>, ExtractOutput<S>>;
75
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/function/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAqEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAU,EACV,OAAgB,EACsC,EAAE;IAGxD,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;IAE9B,MAAM,SAAS,GAAG,CAAC,CAAC,KAAoC,EAAE,EAAE;QAC1D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAsC,CAAC;IAExC,SAAS,CAAC,SAAS,GAAG,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;YACrC,MAAM,IAAI,SAAS,CAAC,OAAO,IAAI,yBAAyB,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,GAAG,UAA+B,EAAE,EAAE;YACrD,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oB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EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAsC,CAAC;IAExC,SAAS,CAAC,SAAS,GAAG,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE,CAAC;YACrC,MAAM,IAAI,SAAS,CAAC,OAAO,IAAI,yBAAyB,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,GAAG,UAA+B,EAAE,EAAE;YACrD,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oBACvD,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;oBACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;wBACrB,MAAM,IAAI,SAAS,CACjB,MAAM,CAAC,OAAO;4BACZ,2BAA2B,KAAK,oBAAoB,CACvD,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,MAAM,WAAW,GACf,UACD,CAAC,GAAI,UAAmC,CAAC,CAAC;YAC3C,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;gBACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACrB,MAAM,IAAI,SAAS,CACjB,MAAM,CAAC,OAAO,IAAI,mCAAmC,CACtD,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,OAAO,WAAkC,CAAC;QAC5C,CAAC,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * `instanceof_` because `instanceof` is a reserved keyword in JavaScript.
6
6
  */
7
7
  import type { ValidateCoreReturnType } from "../../Validate/type";
8
- type Constructor<T> = new (...arguments_: any[]) => T;
8
+ export type Constructor<T> = new (...arguments_: any[]) => T;
9
9
  /**
10
10
  * Creates a validator that checks whether a value is an instance of the given
11
11
  * constructor. Subclasses of the constructor satisfy the validator, matching
@@ -16,4 +16,3 @@ type Constructor<T> = new (...arguments_: any[]) => T;
16
16
  * @returns {Function} - Validator function for instances of the constructor
17
17
  */
18
18
  export declare const instanceof_: <T>(classConstructor: Constructor<T>, message?: string) => (value: T) => ValidateCoreReturnType<T>;
19
- export {};
@@ -5,7 +5,7 @@
5
5
  * `arrayOf()` validates each element of an array.
6
6
  */
7
7
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
8
- type ExtractValidatedType<V> = V extends (value: never) => {
8
+ export type MapExtractValidatedType<V> = V extends (value: never) => {
9
9
  type: infer T;
10
10
  } ? ValidateType<T> : never;
11
11
  /**
@@ -20,5 +20,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
20
20
  * @param {string} [message] - Custom error message for type validation
21
21
  * @returns {Function} - Validator function for Map instances
22
22
  */
23
- export declare const map: <KV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, VV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, K = ExtractValidatedType<KV>, V = ExtractValidatedType<VV>>(keyValidator?: KV, valueValidator?: VV, message?: string) => (value: Map<K, V>) => ValidateCoreReturnType<Map<K, V>>;
24
- export {};
23
+ export declare const map: <KV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, VV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, K = MapExtractValidatedType<KV>, V = MapExtractValidatedType<VV>>(keyValidator?: KV, valueValidator?: VV, message?: string) => (value: Map<K, V>) => ValidateCoreReturnType<Map<K, V>>;
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/map/core.ts"],"names":[],"mappings":"AAAA;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,MAAM,GAAG,GAAG,CAYjB,YAAiB,EACjB,cAAmB,EACnB,OAAgB,EAChB,EAAE;IACF,OAAO,CAAC,KAAgB,EAAqC,EAAE;QAC7D,IAAI,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC;YAC3C,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,SAAS,GACb,YACD,CAAC,QAAQ,CAAC,CAAC;gBACZ,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;oBACxB,OAAO;wBACL,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE,SAAS,CAAC,OAAO;wBAC1B,IAAI,EAAE,KAAK;qBACZ,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,IAAI,cAAc,EAAE,CAAC;gBACnB,MAAM,WAAW,GACf,cAID,CAAC,UAAU,CAAC,CAAC;gBACd,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;oBAC1B,OAAO;wBACL,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE,WAAW,CAAC,OAAO;wBAC5B,IAAI,EAAE,KAAK;qBACZ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,12 +1,14 @@
1
- import type { UnionToIntersection } from "../../types/logic";
2
1
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
3
- type ExtractValidatedType<V> = V extends (value: never) => {
2
+ export type IntersectionExtractValidatedType<V> = V extends (value: never) => {
4
3
  type: infer T;
5
4
  } ? ValidateType<T> : never;
5
+ export type IntersectValidatedTypes<Vs> = Vs extends readonly [
6
+ infer Head,
7
+ ...infer Tail
8
+ ] ? IntersectionExtractValidatedType<Head> & IntersectValidatedTypes<Tail> : unknown;
6
9
  /**
7
10
  * Creates an intersection validator that passes only if all given validators pass
8
11
  * @param validators - Validator functions to compose as an intersection (logical AND)
9
12
  * @returns {Function} - Validator that checks if the value matches all validators
10
13
  */
11
- export declare const intersection: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => (value: UnionToIntersection<ExtractValidatedType<Vs[number]>>) => ValidateCoreReturnType<UnionToIntersection<ExtractValidatedType<Vs[number]>>>;
12
- export {};
14
+ export declare const intersection: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => (value: IntersectValidatedTypes<Vs>) => ValidateCoreReturnType<IntersectValidatedTypes<Vs>>;
@@ -1 +1 @@
1
- {"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAA4D,EAG5D,EAAE;QACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAKD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,KAEL;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAEL;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../../src/Validate/object/intersection.ts"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAG1B,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAAkC,EACmB,EAAE;QACvD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,IAAI,EAAE,KAAsD;iBAC7D,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAsD;SAC7D,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- interface NullReturn {
1
+ export interface NullReturn {
2
2
  validate: boolean;
3
3
  message: string;
4
4
  type: "null";
@@ -15,4 +15,3 @@ export declare const nullable: <T, R extends {
15
15
  message: string;
16
16
  validate: boolean;
17
17
  }>(validator: (value: T) => R) => ((value: T | null) => R | NullReturn);
18
- export {};
@@ -1,4 +1,4 @@
1
- interface UndefinedReturn {
1
+ export interface UndefinedReturn {
2
2
  validate: boolean;
3
3
  message: string;
4
4
  type: "undefined";
@@ -33,4 +33,3 @@ export declare const optional: <T, R extends {
33
33
  message: string;
34
34
  validate: boolean;
35
35
  }>(validator: (value: T) => R) => OptionalValidator<T, R>;
36
- export {};
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ObjectShape, type ObjectValidator } from "./core";
8
8
  import { type OptionalValidator } from "./optional";
9
- type PartialShape<T extends ObjectShape> = {
9
+ export type PartialShape<T extends ObjectShape> = {
10
10
  [K in keyof T]: OptionalValidator<Parameters<T[K]>[0], ReturnType<T[K]> extends {
11
11
  type: unknown;
12
12
  message: string;
@@ -22,4 +22,3 @@ type PartialShape<T extends ObjectShape> = {
22
22
  * @returns {ObjectValidator<PartialShape<T>>} - New validator where every key accepts undefined
23
23
  */
24
24
  export declare const partial: <T extends ObjectShape>(validator: ObjectValidator<T>, message?: string) => ObjectValidator<PartialShape<T>>;
25
- export {};
@@ -6,8 +6,8 @@
6
6
  */
7
7
  import { type ObjectShape, type ObjectValidator } from "./core";
8
8
  import type { OptionalValidator } from "./optional";
9
- type UnwrapOptional<V> = V extends OptionalValidator<infer Inner, infer R> ? (value: Inner) => R : V;
10
- type RequiredShape<T extends ObjectShape> = {
9
+ export type UnwrapOptional<V> = V extends OptionalValidator<infer Inner, infer R> ? (value: Inner) => R : V;
10
+ export type RequiredShape<T extends ObjectShape> = {
11
11
  [K in keyof T]: UnwrapOptional<T[K]> extends ObjectShape[string] ? UnwrapOptional<T[K]> : T[K];
12
12
  };
13
13
  /**
@@ -19,4 +19,3 @@ type RequiredShape<T extends ObjectShape> = {
19
19
  * @returns {ObjectValidator<RequiredShape<T>>} - New validator where every optional layer is removed
20
20
  */
21
21
  export declare const required: <T extends ObjectShape>(validator: ObjectValidator<T>, message?: string) => ObjectValidator<RequiredShape<T>>;
22
- export {};
@@ -1,5 +1,5 @@
1
1
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
2
- type ExtractValidatedType<V> = V extends (value: never) => {
2
+ export type UnionExtractValidatedType<V> = V extends (value: never) => {
3
3
  type: infer T;
4
4
  } ? ValidateType<T> : never;
5
5
  /**
@@ -7,5 +7,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
7
7
  * @param validators - Validator functions to compose as a union (logical OR)
8
8
  * @returns {Function} - Validator that checks if the value matches any of the validators
9
9
  */
10
- export declare const union: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => (value: ExtractValidatedType<Vs[number]>) => ValidateCoreReturnType<ExtractValidatedType<Vs[number]>>;
11
- export {};
10
+ export declare const union: <Vs extends ((value: never) => ValidateCoreReturnType<unknown>)[]>(...validators: [...Vs]) => (value: UnionExtractValidatedType<Vs[number]>) => ValidateCoreReturnType<UnionExtractValidatedType<Vs[number]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAAuC,EACmB,EAAE;QAC5D,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,KAA2D;iBAClE,CAAC;YACJ,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,KAA2D;SAClE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"union.js","sourceRoot":"","sources":["../../../src/Validate/object/union.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAGnB,GAAG,UAAmB,EACtB,EAAE;IACF,OAAO,CACL,KAA4C,EACmB,EAAE;QACjE,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,MAAM,GACV,SAGD,CAAC,KAAK,CAAC,CAAC;YACT,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE,KAEL;iBACF,CAAC;YACJ,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,KAAgE;SACvE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -8,7 +8,7 @@
8
8
  * already exposes a `set` runtime helper.
9
9
  */
10
10
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
11
- type ExtractValidatedType<V> = V extends (value: never) => {
11
+ export type SetExtractValidatedType<V> = V extends (value: never) => {
12
12
  type: infer T;
13
13
  } ? ValidateType<T> : never;
14
14
  /**
@@ -20,5 +20,4 @@ type ExtractValidatedType<V> = V extends (value: never) => {
20
20
  * @param {string} [message] - Custom error message for type validation
21
21
  * @returns {Function} - Validator function for Set instances
22
22
  */
23
- export declare const set_: <IV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, T = ExtractValidatedType<IV>>(itemValidator?: IV, message?: string) => (value: Set<T>) => ValidateCoreReturnType<Set<T>>;
24
- export {};
23
+ export declare const set_: <IV extends (value: any) => ValidateCoreReturnType<unknown> = (value: unknown) => ValidateCoreReturnType<unknown>, T = SetExtractValidatedType<IV>>(itemValidator?: IV, message?: string) => (value: Set<T>) => ValidateCoreReturnType<Set<T>>;
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/set/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAOlB,aAAkB,EAClB,OAAgB,EAChB,EAAE;IACF,OAAO,CAAC,KAAa,EAAkC,EAAE;QACvD,IAAI,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAA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,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -5,20 +5,23 @@
5
5
  * such as `'standard' | 'squat' | 'decanter' | 'round' | 'tall' | 'flask'`.
6
6
  *
7
7
  * The validator's return type carries the literal union through its `type`
8
- * field directly (instead of going through `Types<T>` which would collapse
9
- * to `"string"`), so consumers like `object()`, `union()`, and `intersection()`
10
- * can preserve the literal union in their inferred types.
8
+ * field as a `LiteralBrand<T>` so that consumers like `object()`, `union()`,
9
+ * and `intersection()` can preserve the literal union in their inferred types.
10
+ * The brand also prevents collisions with reserved type tags such as
11
+ * `"string"`, `"number"`, or `"boolean"` when an allowed value happens to
12
+ * match one of those tag strings.
11
13
  */
14
+ import type { LiteralBrand } from "../../Validate/type";
12
15
  /**
13
16
  * Return type produced by a `oneOf` validator. Structurally compatible with
14
- * `ValidateCoreReturnType<unknown>`, but exposes the literal union directly
15
- * via the `type` field so the inferred type can flow through `object()`,
16
- * `union()`, and `intersection()` without being collapsed to `string`.
17
+ * `ValidateCoreReturnType<unknown>`, but exposes the literal union via a
18
+ * `LiteralBrand` so the inferred type can flow through `object()`, `union()`,
19
+ * and `intersection()` without being collapsed by `ValidateType`.
17
20
  */
18
21
  export interface OneOfReturnType<T extends string> {
19
22
  validate: boolean;
20
23
  message: string;
21
- type: T;
24
+ type: LiteralBrand<T>;
22
25
  }
23
26
  /**
24
27
  * Creates a top-level validator that checks if a string value is one of the
@@ -5,9 +5,11 @@
5
5
  * such as `'standard' | 'squat' | 'decanter' | 'round' | 'tall' | 'flask'`.
6
6
  *
7
7
  * The validator's return type carries the literal union through its `type`
8
- * field directly (instead of going through `Types<T>` which would collapse
9
- * to `"string"`), so consumers like `object()`, `union()`, and `intersection()`
10
- * can preserve the literal union in their inferred types.
8
+ * field as a `LiteralBrand<T>` so that consumers like `object()`, `union()`,
9
+ * and `intersection()` can preserve the literal union in their inferred types.
10
+ * The brand also prevents collisions with reserved type tags such as
11
+ * `"string"`, `"number"`, or `"boolean"` when an allowed value happens to
12
+ * match one of those tag strings.
11
13
  */
12
14
  /**
13
15
  * Creates a top-level validator that checks if a string value is one of the
@@ -1 +1 @@
1
- {"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../src/Validate/string/oneOf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAS,EACT,OAAgB,EAChB,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,CAAC;IACxC,OAAO,CAAC,KAAa,EAA8B,EAAE;QACnD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO;YACL,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC;YACvC,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../src/Validate/string/oneOf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgBH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAS,EACT,OAAgB,EAChB,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,CAAC;IACxC,OAAO,CAAC,KAAa,EAA8B,EAAE;QACnD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO;YACL,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC;YACvC,IAAI,EAAE,KAAgC;SACvC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * inferred type is the corresponding TypeScript template literal type.
8
8
  */
9
9
  import type { ValidateType } from "../../Validate/type";
10
- type AnyValidator = (value?: any) => {
10
+ export type TemplateLiteralAnyValidator = (value?: any) => {
11
11
  type: unknown;
12
12
  };
13
13
  /**
@@ -15,12 +15,12 @@ type AnyValidator = (value?: any) => {
15
15
  * string literal that must appear verbatim, or a primitive validator whose
16
16
  * accepted shape is converted to a regex fragment at construction time.
17
17
  */
18
- export type TemplateLiteralPart = string | AnyValidator;
19
- type ExtractValidatorTag<V> = V extends (value: never) => {
18
+ export type TemplateLiteralPart = string | TemplateLiteralAnyValidator;
19
+ export type ExtractValidatorTag<V> = V extends (value: never) => {
20
20
  type: infer T;
21
21
  } ? T : never;
22
- type TagToTemplate<T> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : ValidateType<T>;
23
- type PartToTemplate<P> = P extends string ? P : TagToTemplate<ExtractValidatorTag<P>>;
22
+ export type TagToTemplate<T> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : ValidateType<T>;
23
+ export type PartToTemplate<P> = P extends string ? P : TagToTemplate<ExtractValidatorTag<P>>;
24
24
  /**
25
25
  * Builds the template literal type produced by joining `Parts`. Each part is
26
26
  * mapped to either its literal string value or to the runtime type that the
@@ -52,4 +52,3 @@ export interface TemplateLiteralReturnType<T extends string> {
52
52
  * @returns {Function} - Validator function for template literal strings
53
53
  */
54
54
  export declare const templateLiteral: <const Parts extends readonly TemplateLiteralPart[]>(parts: Parts, message?: string) => (value: BuildTemplateLiteral<Parts>) => TemplateLiteralReturnType<BuildTemplateLiteral<Parts>>;
55
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/Validate/templateLite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AAE;IACX,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,MAAM,EAAE,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAG7B,KAAY,EACZ,OAAgB,EAChB,EAAE;IACF,IAAI,OAAO,GAAG,GAAG,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO;YACL,OAAO,IAAI,KAAK,QAAQ;gBACtB,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC;gBACnB,CAAC,CAAC,MAAM,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,GAAG,CAAC;IACf,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAElC,OAAO,CACL,KAAkC,EACsB,EAAE;QAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -30,16 +30,28 @@ export interface ValidateReturnType<T> {
30
30
  * @template T - The type of value to validate
31
31
  */
32
32
  export type ValidateFunctionType<T> = (value: T) => boolean;
33
+ declare const LITERAL_BRAND: unique symbol;
34
+ /**
35
+ * Branded literal type used by validators (such as `oneOf`) that need to keep
36
+ * a string literal verbatim through `ValidateType`. The brand prevents the
37
+ * literal from colliding with reserved type tags like `"string"`, `"number"`,
38
+ * or `"boolean"` when the same string also happens to name a primitive type.
39
+ * @template T - The literal value preserved by the brand
40
+ */
41
+ export type LiteralBrand<T extends string> = T & {
42
+ readonly [LITERAL_BRAND]: T;
43
+ };
33
44
  export type _ValidateType<T> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T;
34
45
  export type _ValidateType2<T> = T extends "undefined" ? undefined : T extends "null" ? null : T;
35
46
  export type _ValidateType3<T> = T extends "bigint" ? bigint : T extends "any" ? any : T extends "unknown" ? unknown : T extends "never" ? never : T;
36
47
  /**
37
48
  * Maps string literal type names back to their TypeScript types
38
49
  * @template T - The string literal type name ("string", "number", "boolean", "bigint", "undefined", "null", "any", "unknown", "never")
39
- * @returns The corresponding TypeScript type or the original type T when no tag matches
50
+ * @returns The corresponding TypeScript type, the unwrapped literal when `T` is a `LiteralBrand`, or the original type `T` when no tag matches
40
51
  */
41
- export type ValidateType<T> = T extends "string" | "number" | "boolean" ? _ValidateType<T> : T extends "undefined" | "null" ? _ValidateType2<T> : T extends "bigint" | "any" | "unknown" | "never" ? _ValidateType3<T> : T;
52
+ export type ValidateType<T> = T extends LiteralBrand<infer L> ? L : T extends "string" | "number" | "boolean" ? _ValidateType<T> : T extends "undefined" | "null" ? _ValidateType2<T> : T extends "bigint" | "any" | "unknown" | "never" ? _ValidateType3<T> : T;
42
53
  export type SchemaToInterface<T extends (value: any) => ValidateCoreReturnType<any>> = ValidateType<ReturnType<T>["type"]>;
43
54
  export type OptionalKeys<T> = {
44
55
  [K in keyof T]: undefined extends T[K] ? K : never;
45
56
  }[keyof T];
57
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { ArrayToUnion } from "../types/logic/arrayToUnion";
2
- interface DayList {
2
+ export interface DayList {
3
3
  de: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
4
4
  ko: ["일", "월", "화", "수", "목", "금", "토"];
5
5
  en: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -17,4 +17,3 @@ interface DayList {
17
17
  * getDay(1, "fr"); // Returns "Lun"
18
18
  */
19
19
  export declare const getDay: <T extends keyof DayList>(day: number, lang?: T) => ArrayToUnion<DayList[T]>;
20
- export {};
@@ -1,6 +1,6 @@
1
- type PropertyName = string | number | symbol;
2
- type IterateeFunction<T> = (value: T) => PropertyName;
3
- type Iteratee<T> = IterateeFunction<T> | keyof T;
1
+ export type PropertyName = string | number | symbol;
2
+ export type IterateeFunction<T> = (value: T) => PropertyName;
3
+ export type Iteratee<T> = IterateeFunction<T> | keyof T;
4
4
  /**
5
5
  * Creates an object composed of keys generated from the results of running each element of collection through iteratee
6
6
  * @param collection The collection to iterate over
@@ -17,4 +17,3 @@ type Iteratee<T> = IterateeFunction<T> | keyof T;
17
17
  * - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
18
18
  */
19
19
  export declare function keyBy<T>(collection: T[] | Record<PropertyName, T>, iteratee?: Iteratee<T>): Record<PropertyName, T>;
20
- export {};
@@ -1,14 +1,16 @@
1
- import type { ValidateCoreReturnType } from "../../Validate/type";
1
+ import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
2
+ export type ArrayOfExtractValidatedType<V> = V extends (value: never) => {
3
+ type: infer T;
4
+ } ? ValidateType<T> : never;
2
5
  /**
3
6
  * Creates an array validator that validates every element with a single validator
4
- * @template T - Element type validated by the wrapped validator
5
- * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through)
6
- * @param {Function} validator - Validator applied to each element (e.g. an object validator)
7
+ * @template V - The validator function applied to each element (its return `type` field carries the element type)
8
+ * @param {V} validator - Validator applied to each element (e.g. an object validator)
7
9
  * @param {string} [message] - Custom error message for array type validation
8
10
  * @returns {Function} - Validator function for arrays whose elements satisfy the given validator
9
11
  */
10
- export declare const arrayOf: <T, R extends {
12
+ export declare const arrayOf: <V extends (value: never) => {
11
13
  type: unknown;
12
14
  message: string;
13
15
  validate: boolean;
14
- }>(validator: (value: T) => R, message?: string) => (values: T[]) => ValidateCoreReturnType<T[]>;
16
+ }>(validator: V, message?: string) => (values: ArrayOfExtractValidatedType<V>[]) => ValidateCoreReturnType<ArrayOfExtractValidatedType<V>[]>;
@@ -8,11 +8,16 @@ var _isArray = require("../../Validate/isArray");
8
8
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
9
9
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
10
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ // Extract the validated value type by reading the validator's `type` field
12
+ // (and applying `ValidateType` to map type tags like "string" back to the
13
+ // runtime type). Reading the field directly lets validators that expose the
14
+ // literal union via the `type` field (such as `oneOf`) flow through arrayOf
15
+ // without being collapsed to `string`.
16
+
11
17
  /**
12
18
  * Creates an array validator that validates every element with a single validator
13
- * @template T - Element type validated by the wrapped validator
14
- * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through)
15
- * @param {Function} validator - Validator applied to each element (e.g. an object validator)
19
+ * @template V - The validator function applied to each element (its return `type` field carries the element type)
20
+ * @param {V} validator - Validator applied to each element (e.g. an object validator)
16
21
  * @param {string} [message] - Custom error message for array type validation
17
22
  * @returns {Function} - Validator function for arrays whose elements satisfy the given validator
18
23
  */
@@ -29,8 +34,8 @@ var arrayOf = exports.arrayOf = function arrayOf(validator, message) {
29
34
  _step;
30
35
  try {
31
36
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
32
- var value = _step.value;
33
- var result = validator(value);
37
+ var _value = _step.value;
38
+ var result = validator(_value);
34
39
  if (!result.validate) {
35
40
  return {
36
41
  validate: false,
@@ -1,2 +1 @@
1
1
  export * from "./arrayOf";
2
- export * from "./core";
@@ -13,15 +13,4 @@ Object.keys(_arrayOf).forEach(function (key) {
13
13
  return _arrayOf[key];
14
14
  }
15
15
  });
16
- });
17
- var _core = require("./core");
18
- Object.keys(_core).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _core[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _core[key];
25
- }
26
- });
27
16
  });
@@ -11,27 +11,27 @@
11
11
  * the schema on every call.
12
12
  */
13
13
  import type { ValidateCoreReturnType, ValidateType } from "../../Validate/type";
14
- type AnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
15
- type ExtractValidatedType<V> = V extends (value: never) => {
14
+ export type FunctionAnyValidator = (value: any) => ValidateCoreReturnType<unknown>;
15
+ export type FunctionExtractValidatedType<V> = V extends (value: never) => {
16
16
  type: infer T;
17
17
  } ? ValidateType<T> : never;
18
- type InferInputs<Inputs> = Inputs extends readonly AnyValidator[] ? {
19
- [K in keyof Inputs]: ExtractValidatedType<Inputs[K]>;
18
+ export type InferInputs<Inputs> = Inputs extends readonly FunctionAnyValidator[] ? {
19
+ [K in keyof Inputs]: FunctionExtractValidatedType<Inputs[K]>;
20
20
  } : any[];
21
- type InferOutput<Output> = Output extends AnyValidator ? ExtractValidatedType<Output> : any;
21
+ export type InferOutput<Output> = Output extends FunctionAnyValidator ? FunctionExtractValidatedType<Output> : any;
22
22
  /**
23
23
  * Function schema definition. `input` describes positional parameters and
24
24
  * `output` describes the return type. Both are optional; when omitted the
25
25
  * validator only enforces that the value is callable.
26
26
  */
27
27
  export interface FunctionSchema {
28
- input?: readonly AnyValidator[];
29
- output?: AnyValidator;
28
+ input?: readonly FunctionAnyValidator[];
29
+ output?: FunctionAnyValidator;
30
30
  }
31
- type ExtractInput<S> = S extends {
31
+ export type ExtractInput<S> = S extends {
32
32
  input: infer I;
33
33
  } ? I : undefined;
34
- type ExtractOutput<S> = S extends {
34
+ export type ExtractOutput<S> = S extends {
35
35
  output: infer O;
36
36
  } ? O : undefined;
37
37
  /**
@@ -72,4 +72,3 @@ export interface FunctionValidator<Inputs, Output> {
72
72
  * @returns {FunctionValidator} - Validator augmented with `implement()`
73
73
  */
74
74
  export declare const function_: <const S extends FunctionSchema = FunctionSchema>(schema?: S, message?: string) => FunctionValidator<ExtractInput<S>, ExtractOutput<S>>;
75
- export {};
@@ -28,8 +28,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
28
28
  * the schema on every call.
29
29
  */
30
30
 
31
- // biome-ignore lint/suspicious/noExplicitAny: validator signatures vary
32
-
33
31
  /**
34
32
  * Function schema definition. `input` describes positional parameters and
35
33
  * `output` describes the return type. Both are optional; when omitted the