@strictly/define 0.0.12 → 0.0.14

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 (34) hide show
  1. package/.out/transformers/flatteners/json_path.d.ts +6 -2
  2. package/.out/transformers/flatteners/json_path.js +15 -2
  3. package/.out/transformers/flatteners/specs/json_paths.tests.d.ts +1 -0
  4. package/.out/transformers/flatteners/specs/json_paths.tests.js +50 -0
  5. package/.out/tsconfig.tsbuildinfo +1 -1
  6. package/.out/types/builders.d.ts +21 -20
  7. package/.out/types/builders.js +8 -5
  8. package/.out/types/flattened_types_of_validating_type.d.ts +4 -4
  9. package/.out/types/flattened_validators_of_validating_type.d.ts +7 -6
  10. package/.out/types/specs/flattened_validators_of_validating_type.tests.js +2 -2
  11. package/.out/types/validating_definitions.d.ts +14 -12
  12. package/.out/types/validating_type_def_with_error.d.ts +13 -13
  13. package/.out/validation/validator.d.ts +1 -0
  14. package/.out/validation/validator.js +4 -0
  15. package/.out/validation/validators/composite_validator.d.ts +7 -0
  16. package/.out/validation/validators/composite_validator.js +32 -0
  17. package/.turbo/turbo-build.log +8 -8
  18. package/.turbo/turbo-check-types.log +1 -1
  19. package/dist/index.cjs +86 -33
  20. package/dist/index.d.cts +85 -79
  21. package/dist/index.d.ts +85 -79
  22. package/dist/index.js +62 -9
  23. package/package.json +1 -1
  24. package/transformers/flatteners/json_path.ts +44 -4
  25. package/transformers/flatteners/specs/json_paths.tests.ts +69 -0
  26. package/types/builders.ts +46 -26
  27. package/types/flattened_types_of_validating_type.ts +5 -2
  28. package/types/flattened_validators_of_validating_type.ts +7 -9
  29. package/types/specs/builder.tests.ts +31 -31
  30. package/types/specs/flattened_validators_of_validating_type.tests.ts +7 -7
  31. package/types/validating_definitions.ts +27 -15
  32. package/types/validating_type_def_with_error.ts +23 -23
  33. package/validation/validator.ts +21 -0
  34. package/validation/validators/composite_validator.ts +42 -0
package/dist/index.cjs CHANGED
@@ -59,9 +59,12 @@ __export(index_exports, {
59
59
  isFunctionalValidator: () => isFunctionalValidator,
60
60
  jsonPath: () => jsonPath,
61
61
  jsonPathPop: () => jsonPathPop,
62
+ jsonPathPrefix: () => jsonPathPrefix,
63
+ jsonPathUnprefix: () => jsonPathUnprefix,
62
64
  list: () => list,
63
65
  literal: () => literal,
64
66
  mergeAnnotations: () => mergeAnnotations,
67
+ mergeValidators: () => mergeValidators,
65
68
  mobxCopy: () => mobxCopy,
66
69
  nullType: () => nullType,
67
70
  nullable: () => nullable,
@@ -220,15 +223,16 @@ function copy(t, proto) {
220
223
  }
221
224
 
222
225
  // transformers/copies/mobx_copy.ts
223
- var import_base3 = require("@strictly/base");
226
+ var import_base4 = require("@strictly/base");
224
227
  var import_mobx = require("mobx");
225
228
 
226
229
  // transformers/flatteners/flatten_value_to.ts
227
- var import_base2 = require("@strictly/base");
230
+ var import_base3 = require("@strictly/base");
228
231
 
229
232
  // transformers/flatteners/json_path.ts
230
- function jsonPath(prefix, segment, qualifier = "") {
231
- const s = `.${qualifier}${segment}`;
233
+ var import_base2 = require("@strictly/base");
234
+ function jsonPath(prefix, segment, qualifier) {
235
+ const s = `.${qualifier != null ? qualifier : ""}${segment}`;
232
236
  return `${prefix}${s}`;
233
237
  }
234
238
  function jsonPathPop(path) {
@@ -241,6 +245,14 @@ function jsonPathPop(path) {
241
245
  parts.pop()
242
246
  ];
243
247
  }
248
+ function jsonPathPrefix(prefix, path) {
249
+ (0, import_base2.assertEqual)(path[0], "$", "{} should start with $", path);
250
+ return `${prefix}${path.slice(1)}`;
251
+ }
252
+ function jsonPathUnprefix(prefix, path) {
253
+ (0, import_base2.assertState)(path.startsWith(prefix), "{} should start with {}", path, prefix);
254
+ return `$${path.slice(prefix.length)}`;
255
+ }
244
256
 
245
257
  // transformers/flatteners/flatten_value_to.ts
246
258
  function flattenValueTo({ definition }, v, setter, mapper2) {
@@ -276,7 +288,7 @@ function internalFlattenValueChildren(valuePath, typePath, qualifier, typeDef, v
276
288
  case 5 /* Union */:
277
289
  return internalFlattenUnionChildren(valuePath, typePath, qualifier, typeDef, v, mapper2, r);
278
290
  default:
279
- throw new import_base2.UnreachableError(typeDef);
291
+ throw new import_base3.UnreachableError(typeDef);
280
292
  }
281
293
  }
282
294
  function internalFlattenListChildren(valuePath, typePath, { elements }, v, mapper2, r) {
@@ -297,7 +309,7 @@ function internalFlattenListChildren(valuePath, typePath, { elements }, v, mappe
297
309
  }
298
310
  function internalFlattenRecordChildren(valuePath, typePath, { valueTypeDef }, v, mapper2, r) {
299
311
  const newTypePath = jsonPath(typePath, "*");
300
- return (0, import_base2.reduce)(
312
+ return (0, import_base3.reduce)(
301
313
  v,
302
314
  function(r2, k, value) {
303
315
  return internalFlattenValue(
@@ -316,7 +328,7 @@ function internalFlattenRecordChildren(valuePath, typePath, { valueTypeDef }, v,
316
328
  );
317
329
  }
318
330
  function internalFlattenObjectChildren(valuePath, typePath, qualifier, { fields }, v, mapper2, r) {
319
- return (0, import_base2.reduce)(
331
+ return (0, import_base3.reduce)(
320
332
  fields,
321
333
  function(r2, k, fieldTypeDef) {
322
334
  const fieldValue = v[k];
@@ -350,7 +362,7 @@ function internalFlattenUnionChildren(valuePath, typePath, qualifier, typeDef, v
350
362
  }
351
363
  function getUnionTypeDef(typeDef, v) {
352
364
  if (typeDef.discriminator == null) {
353
- return (0, import_base2.reduce)(
365
+ return (0, import_base3.reduce)(
354
366
  typeDef.unions,
355
367
  function(acc, _k, t) {
356
368
  if (t.type === 1 /* Literal */ && t.valuePrototype) {
@@ -391,7 +403,7 @@ function observeValue(v, def) {
391
403
  case 4 /* Object */:
392
404
  return (0, import_mobx.makeObservable)(
393
405
  v,
394
- (0, import_base3.reduce)(
406
+ (0, import_base4.reduce)(
395
407
  def.fields,
396
408
  function(acc, k) {
397
409
  acc[k] = import_mobx.observable;
@@ -407,7 +419,7 @@ function observeValue(v, def) {
407
419
  case 5 /* Union */:
408
420
  return observeValue(v, getUnionTypeDef(def, v));
409
421
  default:
410
- throw new import_base3.UnreachableError(def);
422
+ throw new import_base4.UnreachableError(def);
411
423
  }
412
424
  }
413
425
  function mobxCopy(t, proto) {
@@ -445,10 +457,10 @@ function flattenJsonValueToTypePathsOf(t, value) {
445
457
  }
446
458
 
447
459
  // transformers/flatteners/flatten_type_to.ts
448
- var import_base4 = require("@strictly/base");
460
+ var import_base5 = require("@strictly/base");
449
461
  function flattenTypeTo({ definition }, mapper2) {
450
462
  const typeDefs = internalFlattenTypeDef("$", definition, {});
451
- return (0, import_base4.reduce)(
463
+ return (0, import_base5.reduce)(
452
464
  typeDefs,
453
465
  function(acc, key, typeDef) {
454
466
  acc[key] = mapper2(typeDef, key);
@@ -475,7 +487,7 @@ function internalFlattenTypeDefChildren(path, qualifier, t, r) {
475
487
  case 5 /* Union */:
476
488
  return internalFlattenUnionTypeDefChildren(path, qualifier, t, r);
477
489
  default:
478
- throw new import_base4.UnreachableError(t);
490
+ throw new import_base5.UnreachableError(t);
479
491
  }
480
492
  }
481
493
  function internalFlattenedListTypeDefChildren(path, { elements }, r) {
@@ -485,7 +497,7 @@ function internalFlattenRecordTypeDefChildren(path, { valueTypeDef }, r) {
485
497
  return internalFlattenTypeDef(jsonPath(path, "*"), valueTypeDef, r);
486
498
  }
487
499
  function internalFlattenObjectTypeDefChildren(path, qualifier, { fields }, r) {
488
- return (0, import_base4.reduce)(
500
+ return (0, import_base5.reduce)(
489
501
  fields,
490
502
  function(acc, fieldName, fieldTypeDef) {
491
503
  return internalFlattenTypeDef(
@@ -501,7 +513,7 @@ function internalFlattenUnionTypeDefChildren(path, qualifier, {
501
513
  discriminator,
502
514
  unions
503
515
  }, r) {
504
- return (0, import_base4.reduce)(
516
+ return (0, import_base5.reduce)(
505
517
  unions,
506
518
  function(acc, key, typeDef) {
507
519
  return internalFlattenTypeDefChildren(
@@ -561,10 +573,10 @@ function flattenValuesOfType(typeDef, value) {
561
573
  }
562
574
 
563
575
  // transformers/flatteners/value_path_to_type_path.ts
564
- var import_base5 = require("@strictly/base");
576
+ var import_base6 = require("@strictly/base");
565
577
  function valuePathToTypePath({ definition: typeDef }, valuePath, allowMissingPaths = false) {
566
578
  const valueSteps = valuePath.split(/\.|\[/g);
567
- (0, import_base5.assertEqual)(valueSteps[0], "$");
579
+ (0, import_base6.assertEqual)(valueSteps[0], "$");
568
580
  const typeSteps = internalJsonValuePathToTypePath(
569
581
  typeDef,
570
582
  valueSteps.slice(1),
@@ -588,7 +600,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
588
600
  if (allowMissingPaths) {
589
601
  return valueSteps;
590
602
  } else {
591
- throw new import_base5.PreconditionFailedError(
603
+ throw new import_base6.PreconditionFailedError(
592
604
  "literal should terminate path {} ({})",
593
605
  originalValuePath,
594
606
  valueStep
@@ -620,7 +632,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
620
632
  return valueSteps;
621
633
  }
622
634
  } else {
623
- (0, import_base5.assertExists)(typeDef.fields[valueStep], "missing field in {} ({})", originalValuePath, valueStep);
635
+ (0, import_base6.assertExists)(typeDef.fields[valueStep], "missing field in {} ({})", originalValuePath, valueStep);
624
636
  }
625
637
  return [
626
638
  valueStep,
@@ -634,7 +646,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
634
646
  case 5 /* Union */:
635
647
  if (typeDef.discriminator == null) {
636
648
  if (remainingValueSteps.length > 0) {
637
- const union2 = (0, import_base5.reduce)(
649
+ const union2 = (0, import_base6.reduce)(
638
650
  typeDef.unions,
639
651
  function(acc, _k, v) {
640
652
  if (v.type !== 1 /* Literal */ || v.type === 1 /* Literal */ && v.valuePrototype == null) {
@@ -644,7 +656,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
644
656
  },
645
657
  null
646
658
  );
647
- (0, import_base5.assertExists)(union2, "expected a complex union {}", originalValuePath);
659
+ (0, import_base6.assertExists)(union2, "expected a complex union {}", originalValuePath);
648
660
  return internalJsonValuePathToTypePath(
649
661
  union2,
650
662
  valueSteps,
@@ -660,7 +672,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
660
672
  if (allowMissingPaths) {
661
673
  return valueSteps;
662
674
  } else {
663
- throw new import_base5.PreconditionFailedError(
675
+ throw new import_base6.PreconditionFailedError(
664
676
  "mismatched qualifiers in {} (at {})",
665
677
  originalValuePath,
666
678
  valueStep
@@ -669,7 +681,7 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
669
681
  }
670
682
  const qualifier = valueStep.substring(0, qualifierIndex);
671
683
  const remainder = valueStep.substring(qualifierIndex + 1);
672
- const union2 = (0, import_base5.assertExistsAndReturn)(typeDef.unions[qualifier], "missing union {}", qualifier);
684
+ const union2 = (0, import_base6.assertExistsAndReturn)(typeDef.unions[qualifier], "missing union {}", qualifier);
673
685
  const [
674
686
  typeStep,
675
687
  ...remainingTypeSteps
@@ -688,10 +700,44 @@ function internalJsonValuePathToTypePath(typeDef, valueSteps, allowMissingPaths,
688
700
  ];
689
701
  }
690
702
  default:
691
- throw new import_base5.UnreachableError(typeDef);
703
+ throw new import_base6.UnreachableError(typeDef);
692
704
  }
693
705
  }
694
706
 
707
+ // validation/validators/composite_validator.ts
708
+ var CompositeValidator = class {
709
+ constructor(...validators) {
710
+ __publicField(this, "validators");
711
+ this.validators = validators;
712
+ }
713
+ validate(v, valuePath, context) {
714
+ return this.validators.reduce((error, validator) => {
715
+ if (error != null) {
716
+ return error;
717
+ }
718
+ return validate(validator, v, valuePath, context);
719
+ }, null);
720
+ }
721
+ annotations(valuePath, context) {
722
+ return this.validators.reduce(({
723
+ required,
724
+ readonly
725
+ }, validator) => {
726
+ const {
727
+ readonly: validatorReadonly,
728
+ required: validatorRequired
729
+ } = annotations(validator, valuePath, context);
730
+ return {
731
+ required: required || validatorRequired,
732
+ readonly: readonly || validatorReadonly
733
+ };
734
+ }, {
735
+ required: false,
736
+ readonly: false
737
+ });
738
+ }
739
+ };
740
+
695
741
  // validation/validator.ts
696
742
  function isFunctionalValidator(v) {
697
743
  return typeof v === "function";
@@ -706,6 +752,9 @@ function validate(validator, v, valuePath, context) {
706
752
  return validator(v, valuePath, context);
707
753
  }
708
754
  }
755
+ function mergeValidators(v1, v2) {
756
+ return new CompositeValidator(v1, v2);
757
+ }
709
758
  function annotations(validator, valuePath, context) {
710
759
  if (isAnnotatedValidator(validator)) {
711
760
  return validator.annotations(valuePath, context);
@@ -724,7 +773,7 @@ function mergeAnnotations(a1, a2) {
724
773
  }
725
774
 
726
775
  // types/type_of_type.ts
727
- var import_base6 = require("@strictly/base");
776
+ var import_base7 = require("@strictly/base");
728
777
  function typeOfType({ definition }) {
729
778
  return {
730
779
  definition: typeDefOfTypeDef(definition)
@@ -743,7 +792,7 @@ function typeDefOfTypeDef(t) {
743
792
  case 5 /* Union */:
744
793
  return typeDefOfUnionTypeDef(t);
745
794
  default:
746
- throw new import_base6.UnreachableError(t);
795
+ throw new import_base7.UnreachableError(t);
747
796
  }
748
797
  }
749
798
  function typeDefOfLiteralTypeDef({
@@ -781,7 +830,7 @@ function typeDefOfObjectTypeDef({
781
830
  }) {
782
831
  return {
783
832
  type,
784
- fields: (0, import_base6.map)(fields, function(_k, v) {
833
+ fields: (0, import_base7.map)(fields, function(_k, v) {
785
834
  return typeDefOfTypeDef(v);
786
835
  })
787
836
  };
@@ -794,7 +843,7 @@ function typeDefOfUnionTypeDef({
794
843
  return {
795
844
  type,
796
845
  discriminator,
797
- unions: (0, import_base6.map)(unions, function(_k, v) {
846
+ unions: (0, import_base7.map)(unions, function(_k, v) {
798
847
  return typeDefOfTypeDef(v);
799
848
  })
800
849
  };
@@ -811,11 +860,11 @@ var TypeDefBuilder = class _TypeDefBuilder {
811
860
  enforce(rule) {
812
861
  return new _TypeDefBuilder(
813
862
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
814
- __spreadProps(__spreadValues(__spreadValues({}, this.definition), isAnnotatedValidator(rule) ? mergeAnnotations(rule.annotations(null, null), this.definition) : {}), {
863
+ __spreadProps(__spreadValues(__spreadValues({}, this.definition), rule != null && isAnnotatedValidator(rule) ? mergeAnnotations(rule.annotations(null, null), this.definition) : {}), {
815
864
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
816
- rule: (value) => {
865
+ rule: (value, valuePath, context) => {
817
866
  var _a;
818
- return (_a = this.definition.rule(value)) != null ? _a : validate(rule, value, null, null);
867
+ return (_a = this.definition.rule(value, valuePath, context)) != null ? _a : rule && validate(rule, value, valuePath, context);
819
868
  }
820
869
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
821
870
  })
@@ -879,8 +928,9 @@ var ObjectTypeDefBuilder = class _ObjectTypeDefBuilder extends TypeDefBuilder {
879
928
  fields: __spreadProps(__spreadValues({}, this.definition.fields), {
880
929
  [name]: __spreadProps(__spreadValues({}, definition), {
881
930
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
882
- rule: function(v) {
883
- return definition.rule(v) || (rule == null ? void 0 : rule(v));
931
+ rule: function(v, valuePath, context) {
932
+ var _a;
933
+ return (_a = definition.rule(v, valuePath, context)) != null ? _a : rule && validate(rule, v, valuePath, context);
884
934
  }
885
935
  })
886
936
  })
@@ -1137,9 +1187,12 @@ var RegexpValidator = _RegexpValidator;
1137
1187
  isFunctionalValidator,
1138
1188
  jsonPath,
1139
1189
  jsonPathPop,
1190
+ jsonPathPrefix,
1191
+ jsonPathUnprefix,
1140
1192
  list,
1141
1193
  literal,
1142
1194
  mergeAnnotations,
1195
+ mergeValidators,
1143
1196
  mobxCopy,
1144
1197
  nullType,
1145
1198
  nullable,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IsEqual, Simplify, UnionToIntersection, SimplifyDeep } from 'type-fest';
2
- import { IsFieldReadonly } from '@strictly/base';
2
+ import { IsFieldReadonly, StringConcatOf } from '@strictly/base';
3
3
 
4
4
  type Type<T extends TypeDef = TypeDef> = {
5
5
  readonly definition: T;
@@ -198,50 +198,75 @@ declare function flattenJsonValueToTypePathsOf<T extends Type, R extends Record<
198
198
 
199
199
  declare function flattenTypesOfType<T extends StrictType>(t: T): Record<string, Type>;
200
200
 
201
+ type Annotations = {
202
+ readonly required: boolean;
203
+ readonly readonly: boolean;
204
+ };
205
+ type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
206
+ type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
207
+ readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
208
+ readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
209
+ };
210
+ type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
211
+ type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
212
+ type ValidationError<Type extends string, Data = {}> = Simplify<{
213
+ type: Type;
214
+ } & Data>;
215
+ declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
216
+ declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
217
+ declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
218
+ declare function mergeValidators<V = any, E1 = any, E2 = any, ValuePath extends string = any, C1 = any, C2 = any>(v1: Validator<V, E1, ValuePath, C1>, v2: Validator<V, E2, ValuePath, C2>): Validator<V, E1 | E2, ValuePath, C1 & C2>;
219
+ declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
220
+ declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
221
+ readonly: boolean;
222
+ required: boolean;
223
+ };
224
+
201
225
  type ValidatingType<T extends ValidatingTypeDef = ValidatingTypeDef> = {
202
226
  readonly definition: T;
203
227
  };
204
- type Rule<E = any, V = any> = (v: V) => E | null;
205
228
  type ErrorOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer E> ? E : never;
206
- type ValidatingTypeDef<E = any> = ValidatingLiteralTypeDef<E> | ValidatingListTypeDef<E> | ValidatingRecordTypeDef<E> | ValidatingObjectTypeDef<E> | ValidatingUnionTypeDef<E>;
229
+ type ContextOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer _E, infer C> ? C : never;
230
+ type Rule<E, C, V = any> = FunctionalValidator<V, E, string, C>;
231
+ type ValidatingTypeDef<E = any, C = any> = ValidatingLiteralTypeDef<E, C> | ValidatingListTypeDef<E, C> | ValidatingRecordTypeDef<E, C> | ValidatingObjectTypeDef<E, C> | ValidatingUnionTypeDef<E, C>;
207
232
  type AnyTypeDef = any;
208
- type ValidatingLiteralTypeDef<E = any, V = any> = {
233
+ type ValidatingLiteralTypeDef<E = any, C = any, V = any> = {
209
234
  readonly type: TypeDefType.Literal;
210
235
  readonly valuePrototype: [V];
211
- readonly rule: Rule<E>;
236
+ readonly rule: Rule<E, C>;
212
237
  readonly required: boolean;
213
238
  readonly readonly: boolean;
214
239
  };
215
- type ValidatingListTypeDef<E = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
240
+ type ValidatingListTypeDef<E = any, C = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
216
241
  readonly type: TypeDefType.List;
217
242
  readonly elements: Ele;
218
- readonly rule: Rule<E>;
243
+ readonly rule: Rule<E, C>;
219
244
  readonly required: boolean;
220
245
  readonly readonly: boolean;
221
246
  };
222
- type ValidatingRecordTypeDef<E = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
247
+ type ValidatingRecordTypeDef<E = any, C = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
223
248
  readonly type: TypeDefType.Record;
224
249
  readonly keyPrototype: K;
225
250
  readonly valueTypeDef: V;
226
- readonly rule: Rule<E>;
251
+ readonly rule: Rule<E, C>;
227
252
  readonly required: boolean;
228
253
  readonly readonly: boolean;
229
254
  };
230
255
  type ValidatingObjectTypeDefFields = {
231
256
  [Key: ObjectFieldKey]: AnyTypeDef;
232
257
  };
233
- type ValidatingObjectTypeDef<E = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
258
+ type ValidatingObjectTypeDef<E = any, C = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
234
259
  readonly type: TypeDefType.Object;
235
260
  readonly fields: Fields;
236
- readonly rule: Rule<E>;
261
+ readonly rule: Rule<E, C>;
237
262
  readonly required: boolean;
238
263
  readonly readonly: boolean;
239
264
  };
240
- type ValidatingUnionTypeDef<E = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
265
+ type ValidatingUnionTypeDef<E = any, C = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
241
266
  readonly discriminator: D;
242
267
  readonly type: TypeDefType.Union;
243
268
  readonly unions: U;
244
- readonly rule: Rule<E>;
269
+ readonly rule: Rule<E, C>;
245
270
  readonly required: boolean;
246
271
  readonly readonly: boolean;
247
272
  };
@@ -254,52 +279,32 @@ type InternalFlattenedTypeDefsOfChildren<T extends TypeDef, SegmentOverride exte
254
279
  type InternalFlattenedTypeDefsOfLiteralChildren = {};
255
280
  type InternalFlattenedTypeDefsOfListChildren<T extends ValidatingListTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['elements'], SegmentOverride, PathOf<Path, number, SegmentOverride>, '', Depth>;
256
281
  type InternalFlattenedTypeDefsOfRecordChildren<T extends ValidatingRecordTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['valueTypeDef'], SegmentOverride, PathOf<Path, T['keyPrototype'], SegmentOverride>, '', Depth>;
257
- type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
258
- readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
282
+ type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer _C, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
283
+ readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, ContextOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
259
284
  readonly '0': Exclude<Fields[K], undefined>;
260
285
  readonly '1': ValidatingLiteralTypeDef<undefined>;
261
286
  }>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth> : InternalFlattenedTypeDefsOf<Exclude<Fields[K], undefined>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth>;
262
287
  }[keyof Fields]> : never : never;
263
- type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
288
+ type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer _C, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
264
289
  readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, '', Depth>;
265
290
  }[keyof Unions]> : UnionToIntersection<{
266
291
  readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, `${Qualifier}${K}:`, Depth>;
267
292
  }[keyof Unions]> : never : never;
268
293
 
269
- type Annotations = {
270
- readonly required: boolean;
271
- readonly readonly: boolean;
272
- };
273
- type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
274
- type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
275
- readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
276
- readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
277
- };
278
- type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
279
- type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
280
- type ValidationError<Type extends string, Data = {}> = Simplify<{
281
- type: Type;
282
- } & Data>;
283
- declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
284
- declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
285
- declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
286
- declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
287
- declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
288
- readonly: boolean;
289
- required: boolean;
290
- };
291
-
292
- type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string, Context> = T extends ValidatingTypeDef<infer E> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, Context> : never;
293
- type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>, Context = ValueOfType<ReadonlyTypeOfType<T>>> = {
294
- [K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K], Context>;
295
- };
294
+ type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string> = T extends ValidatingTypeDef<infer E, infer C> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, C> : never;
295
+ type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>> = Simplify<{
296
+ [K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K]>;
297
+ }>;
296
298
 
297
299
  declare function flattenValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfValidatingType<T, '*'>>(type: T): FlattenedValidatorsOfValidatingType<T, TypePathsToValuePaths, FlattenedTypes>;
298
300
 
299
301
  declare function flattenValuesOfType<T extends Type>(typeDef: Type, value: ValueOfType<T>): Readonly<Record<string, any>>;
300
302
 
301
- declare function jsonPath(prefix: string, segment: number | string, qualifier?: string): string;
302
- declare function jsonPathPop(path: string): [string, string] | null;
303
+ declare function jsonPath<Prefix extends string, Segment extends number | string>(prefix: Prefix, segment: Segment): `${Prefix}.${Segment}`;
304
+ declare function jsonPath<Prefix extends string, Segment extends number | string, Qualifier extends string>(prefix: Prefix, segment: Segment, qualifier: Qualifier): `${Prefix}.${Qualifier}${Segment}`;
305
+ declare function jsonPathPop<Path extends string>(path: Path): [string, string] | null;
306
+ declare function jsonPathPrefix<Prefix extends string, Path extends string>(prefix: Prefix, path: Path): Path extends StringConcatOf<'$', infer ToMount> ? `${Prefix}${ToMount}` : never;
307
+ declare function jsonPathUnprefix<Prefix extends string, Path extends string>(prefix: Prefix, path: Path): Path extends StringConcatOf<Prefix, infer ToUnmount> ? `$${ToUnmount}` : never;
303
308
 
304
309
  declare function valuePathToTypePath<ValuePathsToTypePaths extends Record<string, string>, ValuePath extends keyof ValuePathsToTypePaths>({ definition: typeDef }: Type, valuePath: ValuePath, allowMissingPaths?: boolean): ValuePathsToTypePaths[ValuePath];
305
310
 
@@ -349,54 +354,54 @@ type TypeDefOfUnionTypeDef<T extends UnionTypeDef> = T extends UnionTypeDef<infe
349
354
  };
350
355
  } : never;
351
356
 
352
- type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E> : never;
353
- type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2> = T extends ValidatingLiteralTypeDef<infer E1, infer V> ? {
357
+ type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E, C> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E, C> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E, C> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E, C> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E, C> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E, C> : never;
358
+ type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2, C2> = T extends ValidatingLiteralTypeDef<infer E1, infer C1, infer V> ? {
354
359
  readonly type: TypeDefType.Literal;
355
360
  readonly valuePrototype: [V];
356
- readonly rule: Rule<E1 | E2>;
361
+ readonly rule: Rule<E1 | E2, C1 & C2>;
357
362
  readonly required: boolean;
358
363
  readonly readonly: boolean;
359
364
  } : never;
360
- type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2> = T extends ValidatingListTypeDef<infer E1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
365
+ type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2, C2> = T extends ValidatingListTypeDef<infer E1, infer C1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
361
366
  readonly type: TypeDefType.List;
362
367
  readonly elements: E;
363
- readonly rule: Rule<E1 | E2>;
368
+ readonly rule: Rule<E1 | E2, C1 & C2>;
364
369
  readonly required: boolean;
365
370
  readonly readonly: boolean;
366
371
  } : {
367
372
  readonly type: TypeDefType.List;
368
373
  elements: E;
369
- readonly rule: Rule<E1 | E2>;
374
+ readonly rule: Rule<E1 | E2, C1 & C2>;
370
375
  readonly required: boolean;
371
376
  readonly readonly: boolean;
372
377
  } : never;
373
- type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2> = T extends ValidatingRecordTypeDef<infer E1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
378
+ type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2, C2> = T extends ValidatingRecordTypeDef<infer E1, infer C1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
374
379
  readonly type: TypeDefType.Record;
375
380
  readonly keyPrototype: K;
376
381
  readonly valueTypeDef: V;
377
- readonly rule: Rule<E1 | E2>;
382
+ readonly rule: Rule<E1 | E2, C1 & C2>;
378
383
  readonly required: boolean;
379
384
  readonly readonly: boolean;
380
385
  } : {
381
386
  readonly type: TypeDefType.Record;
382
387
  readonly keyPrototype: K;
383
388
  valueTypeDef: V;
384
- readonly rule: Rule<E1 | E2>;
389
+ readonly rule: Rule<E1 | E2, C1 & C2>;
385
390
  readonly required: boolean;
386
391
  readonly readonly: boolean;
387
392
  } : never;
388
- type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2> = T extends ValidatingObjectTypeDef<infer E1, infer Fields> ? {
393
+ type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2, C2> = T extends ValidatingObjectTypeDef<infer E1, infer C1, infer Fields> ? {
389
394
  readonly type: TypeDefType.Object;
390
395
  readonly fields: Fields;
391
- readonly rule: Rule<E1 | E2>;
396
+ readonly rule: Rule<E1 | E2, C1 & C2>;
392
397
  readonly required: boolean;
393
398
  readonly readonly: boolean;
394
399
  } : never;
395
- type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T extends ValidatingUnionTypeDef<infer E1, infer D, infer U> ? {
400
+ type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2, C2> = T extends ValidatingUnionTypeDef<infer E1, infer C1, infer D, infer U> ? {
396
401
  readonly type: TypeDefType.Union;
397
402
  readonly discriminator: D;
398
403
  readonly unions: U;
399
- readonly rule: Rule<E1 | E2>;
404
+ readonly rule: Rule<E1 | E2, C1 & C2>;
400
405
  readonly required: boolean;
401
406
  readonly readonly: boolean;
402
407
  } : never;
@@ -404,7 +409,8 @@ type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T e
404
409
  declare class TypeDefBuilder<T extends ValidatingTypeDef> implements ValidatingType<T> {
405
410
  readonly definition: T;
406
411
  constructor(definition: T);
407
- enforce<E2>(rule: Rule<E2, ValueOfType<Type<T>>> | Validator<ValueOfType<Type<T>>, E2, never, never>): TypeDefBuilder<ValidatingTypeDefWithError<T, E2>>;
412
+ enforce<E2, C2>(): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
413
+ enforce<E2, C2>(rule: Validator<ValueOfType<Type<T>>, E2, string, C2>): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
408
414
  required(): TypeDefBuilder<T>;
409
415
  readonly(): TypeDefBuilder<T>;
410
416
  get _type(): TypeOfType<Type<T>>;
@@ -444,29 +450,29 @@ declare class RecordTypeDefBuilder<T extends ValidatingRecordTypeDef> extends Ty
444
450
  readonly readonly: boolean;
445
451
  }>;
446
452
  }
447
- declare class ObjectTypeDefBuilder<E, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, Fields>> {
448
- field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Record<Name, T>>;
449
- field<Name extends string, T extends ValidatingTypeDef, RequiredError>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError>>>;
450
- readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Readonly<Record<Name, T>>>;
451
- optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Record<Name, T>>>;
452
- readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Readonly<Record<Name, T>>>>;
453
+ declare class ObjectTypeDefBuilder<E, C, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, C, Fields>> {
454
+ field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Record<Name, T>>;
455
+ field<Name extends string, T extends ValidatingTypeDef, RequiredError, C2>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, C & C2, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError, C & C2>>>;
456
+ readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Readonly<Record<Name, T>>>;
457
+ optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Record<Name, T>>>;
458
+ readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Readonly<Record<Name, T>>>>;
453
459
  }
454
- declare class UnionTypeDefBuilder<E, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, D, U>> {
455
- or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, D, Readonly<Record<K, T>> & U>;
460
+ declare class UnionTypeDefBuilder<E, C, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, C, D, U>> {
461
+ or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, C, D, Readonly<Record<K, T>> & U>;
456
462
  }
457
- declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, T>>;
458
- declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, string>>;
459
- declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, number>>;
460
- declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, boolean>>;
461
- declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, null>>;
462
- declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, null, {
463
+ declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, T>>;
464
+ declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, string>>;
465
+ declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, number>>;
466
+ declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, boolean>>;
467
+ declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, null>>;
468
+ declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, {}, null, {
463
469
  readonly ['0']: T;
464
- readonly ['1']: ValidatingLiteralTypeDef<never, null>;
470
+ readonly ['1']: ValidatingLiteralTypeDef<never, {}, null>;
465
471
  }>;
466
472
  declare function list<T extends ValidatingTypeDef>(elements: ValidatingType<T>): ListTypeDefBuilder<{
467
473
  readonly type: TypeDefType.List;
468
474
  elements: T;
469
- readonly rule: Rule<never>;
475
+ readonly rule: Rule<never, {}>;
470
476
  readonly readonly: boolean;
471
477
  readonly required: boolean;
472
478
  }>;
@@ -474,13 +480,13 @@ declare function record<V extends ValidatingType, K extends RecordKeyType>({ def
474
480
  readonly type: TypeDefType.Record;
475
481
  readonly keyPrototype: K;
476
482
  valueTypeDef: V["definition"];
477
- readonly rule: Rule<never>;
483
+ readonly rule: Rule<never, {}>;
478
484
  readonly readonly: boolean;
479
485
  readonly required: boolean;
480
486
  }>;
481
487
  declare function object(): ObjectTypeDefBuilder<never, {}>;
482
- declare function union<D extends null>(): UnionTypeDefBuilder<never, D, {}>;
483
- declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, D, {}>;
488
+ declare function union<D extends null>(): UnionTypeDefBuilder<never, {}, D, {}>;
489
+ declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, {}, D, {}>;
484
490
 
485
491
  type PathsOfType<T extends Type, SegmentOverride extends string | null = null, Prefix extends string = '$'> = InternalJsonPathsOf<T['definition'], Prefix, SegmentOverride, StartingDepth>;
486
492
  type InternalJsonPathsOf<F extends TypeDef, Prefix extends string, SegmentOverride extends string | null, Depth extends number, NextDepth extends number = Depths[Depth]> = InternalJsonPathsOfChildren<F, Prefix, SegmentOverride, '', NextDepth> | Prefix;
@@ -592,4 +598,4 @@ type ValidatorsOfValues<FlattenedValues extends Readonly<Record<string, any>>, T
592
598
  readonly [K in keyof FlattenedValues]: Validator<FlattenedValues[K], any, TypePathsToValuePaths[K], Context>;
593
599
  };
594
600
 
595
- export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, list, literal, mergeAnnotations, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };
601
+ export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, jsonPathPrefix, jsonPathUnprefix, list, literal, mergeAnnotations, mergeValidators, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };