@sinclair/typebox 0.30.4 → 0.31.0-dev-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/typebox.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const Transform: unique symbol;
1
2
  export declare const Readonly: unique symbol;
2
3
  export declare const Optional: unique symbol;
3
4
  export declare const Hint: unique symbol;
@@ -148,6 +149,8 @@ export interface DateOptions extends SchemaOptions {
148
149
  maximumTimestamp?: number;
149
150
  /** The minimum timestamp value */
150
151
  minimumTimestamp?: number;
152
+ /** The multiple of timestamp value */
153
+ multipleOfTimestamp?: number;
151
154
  }
152
155
  export interface TDate extends TSchema, DateOptions {
153
156
  [Kind]: 'Date';
@@ -284,8 +287,11 @@ export type ObjectProperties<T> = T extends TObject<infer U> ? U : never;
284
287
  export type ObjectPropertyKeys<T> = T extends TObject<infer U> ? keyof U : never;
285
288
  export type TAdditionalProperties = undefined | TSchema | boolean;
286
289
  export interface ObjectOptions extends SchemaOptions {
290
+ /** Additional property constraints for this object */
287
291
  additionalProperties?: TAdditionalProperties;
292
+ /** The minimum number of properties allowed on this object */
288
293
  minProperties?: number;
294
+ /** The maximum number of properties allowed on this object */
289
295
  maxProperties?: number;
290
296
  }
291
297
  export interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
@@ -362,7 +368,7 @@ export interface TRef<T extends TSchema = TSchema> extends TSchema {
362
368
  static: Static<T, this['params']>;
363
369
  $ref: string;
364
370
  }
365
- export type TRest<T extends TSchema> = T extends TTuple<infer R> ? Assert<R, TSchema[]> : Assert<[T], TSchema[]>;
371
+ export type TRest<T extends TSchema> = T extends TIntersect<infer R> ? R : T extends TUnion<infer R> ? R : T extends TTuple<infer R> ? R : [];
366
372
  export type TReturnType<T extends TFunction> = T['returns'];
367
373
  export type TRequiredRest<T extends TSchema[]> = AssertRest<{
368
374
  [K in keyof T]: TRequired<AssertType<T[K]>>;
@@ -420,10 +426,26 @@ export interface TTemplateLiteral<T extends TTemplateLiteralKind[] = TTemplateLi
420
426
  type: 'string';
421
427
  pattern: string;
422
428
  }
423
- export type TTupleInfer<T extends TSchema[], P extends unknown[]> = T extends [infer L, ...infer R] ? [Static<AssertType<L>, P>, ...TTupleInfer<AssertRest<R>, P>] : [];
429
+ export type DecodeStaticProperties<T extends TProperties> = {
430
+ [K in keyof T]: DecodeStaticType<T[K]>;
431
+ };
432
+ export type DecodeStaticRest<T extends TSchema[]> = T extends [infer L, ...infer R] ? [DecodeStaticType<AssertType<L>>, ...DecodeStaticRest<AssertRest<R>>] : [];
433
+ export type DecodeStaticType<T extends TSchema> = T extends TTransform<infer _, infer R> ? TUnsafe<R> : T extends TArray<infer S> ? TArray<DecodeStaticType<S>> : T extends TAsyncIterator<infer S> ? TAsyncIterator<DecodeStaticType<S>> : T extends TConstructor<infer P, infer R> ? TConstructor<AssertRest<DecodeStaticRest<P>>, DecodeStaticType<R>> : T extends TFunction<infer P, infer R> ? TFunction<AssertRest<DecodeStaticRest<P>>, DecodeStaticType<R>> : T extends TIntersect<infer S> ? TIntersect<AssertRest<DecodeStaticRest<S>>> : T extends TIterator<infer S> ? TIterator<DecodeStaticType<S>> : T extends TNot<infer S> ? TNot<DecodeStaticType<S>> : T extends TObject<infer S> ? TObject<Evaluate<DecodeStaticProperties<S>>> : T extends TPromise<infer S> ? TPromise<DecodeStaticType<S>> : T extends TRecord<infer K, infer S> ? TRecord<K, DecodeStaticType<S>> : T extends TRecursive<infer S> ? TRecursive<DecodeStaticType<S>> : T extends TRef<infer S> ? TRef<DecodeStaticType<S>> : T extends TTuple<infer S> ? TTuple<AssertRest<DecodeStaticRest<S>>> : T extends TUnion<infer S> ? TUnion<AssertRest<DecodeStaticRest<S>>> : T;
434
+ export type TransformFunction<T = any, U = any> = (value: T) => U;
435
+ export interface TransformOptions<I extends TSchema = TSchema, O extends unknown = unknown> {
436
+ Decode: TransformFunction<StaticDecode<I>, O>;
437
+ Encode: TransformFunction<O, StaticDecode<I>>;
438
+ }
439
+ export type TTransformResolve<T extends TSchema, P extends unknown[] = []> = T extends TTransform<infer _, infer S> ? S : Static<T, P>;
440
+ export interface TTransform<I extends TSchema = TSchema, O extends unknown = unknown> extends TSchema {
441
+ static: TTransformResolve<I, this['params']>;
442
+ [Transform]: TransformOptions<I, O>;
443
+ [key: string]: any;
444
+ }
445
+ export type TTupleRest<T extends TSchema[], P extends unknown[]> = T extends [infer L, ...infer R] ? [Static<AssertType<L>, P>, ...TTupleRest<AssertRest<R>, P>] : [];
424
446
  export interface TTuple<T extends TSchema[] = TSchema[]> extends TSchema {
425
447
  [Kind]: 'Tuple';
426
- static: TTupleInfer<T, this['params']>;
448
+ static: TTupleRest<T, this['params']>;
427
449
  type: 'array';
428
450
  items?: T;
429
451
  additionalItems?: false;
@@ -474,7 +496,11 @@ export interface TVoid extends TSchema {
474
496
  static: void;
475
497
  type: 'void';
476
498
  }
477
- /** Infers a static type from a TypeBox type */
499
+ /** Creates the decoded static form for a TypeBox type */
500
+ export type StaticDecode<T extends TSchema, P extends unknown[] = []> = Static<DecodeStaticType<T>, P>;
501
+ /** Creates the encoded static form for a TypeBox type */
502
+ export type StaticEncode<T extends TSchema, P extends unknown[] = []> = Static<T, P>;
503
+ /** Creates the static type for a TypeBox type */
478
504
  export type Static<T extends TSchema, P extends unknown[] = []> = (T & {
479
505
  params: P;
480
506
  })['static'];
@@ -494,6 +520,9 @@ export declare namespace TypeRegistry {
494
520
  /** Gets a custom validation function for a user defined type */
495
521
  function Get(kind: string): TypeRegistryValidationFunction<any> | undefined;
496
522
  }
523
+ export declare class TypeBoxError extends Error {
524
+ constructor(message: string);
525
+ }
497
526
  export type FormatRegistryValidationFunction = (value: string) => boolean;
498
527
  /** A registry for user defined string formats */
499
528
  export declare namespace FormatRegistry {
@@ -510,19 +539,26 @@ export declare namespace FormatRegistry {
510
539
  /** Gets a validation function for a user defined string format */
511
540
  function Get(format: string): FormatRegistryValidationFunction | undefined;
512
541
  }
542
+ /** Provides functions to type guard raw JavaScript values */
513
543
  export declare namespace ValueGuard {
514
- function IsObject(value: unknown): value is Record<PropertyKey, unknown>;
544
+ /** Returns true if this value is an array */
515
545
  function IsArray(value: unknown): value is unknown[];
546
+ /** Returns true if this value is bigint */
547
+ function IsBigInt(value: unknown): value is bigint;
548
+ /** Returns true if this value is a boolean */
516
549
  function IsBoolean(value: unknown): value is boolean;
550
+ /** Returns true if this value is null */
517
551
  function IsNull(value: unknown): value is null;
518
- function IsUndefined(value: unknown): value is undefined;
519
- function IsBigInt(value: unknown): value is bigint;
552
+ /** Returns true if this value is number */
520
553
  function IsNumber(value: unknown): value is number;
554
+ /** Returns true if this value is an object */
555
+ function IsObject(value: unknown): value is Record<PropertyKey, unknown>;
556
+ /** Returns true if this value is string */
521
557
  function IsString(value: unknown): value is string;
558
+ /** Returns true if this value is undefined */
559
+ function IsUndefined(value: unknown): value is undefined;
522
560
  }
523
- export declare class TypeGuardUnknownTypeError extends Error {
524
- readonly schema: unknown;
525
- constructor(schema: unknown);
561
+ export declare class TypeGuardUnknownTypeError extends TypeBoxError {
526
562
  }
527
563
  /** Provides functions to test if JavaScript values are TypeBox types */
528
564
  export declare namespace TypeGuard {
@@ -578,6 +614,10 @@ export declare namespace TypeGuard {
578
614
  function TPromise(schema: unknown): schema is TPromise;
579
615
  /** Returns true if the given schema is TRecord */
580
616
  function TRecord(schema: unknown): schema is TRecord;
617
+ /** Returns true if this schema is TRecursive */
618
+ function TRecursive(schema: unknown): schema is {
619
+ [Hint]: 'Recursive';
620
+ };
581
621
  /** Returns true if the given schema is TRef */
582
622
  function TRef(schema: unknown): schema is TRef;
583
623
  /** Returns true if the given schema is TString */
@@ -588,6 +628,10 @@ export declare namespace TypeGuard {
588
628
  function TTemplateLiteral(schema: unknown): schema is TTemplateLiteral;
589
629
  /** Returns true if the given schema is TThis */
590
630
  function TThis(schema: unknown): schema is TThis;
631
+ /** Returns true of this schema is TTransform */
632
+ function TTransform(schema: unknown): schema is {
633
+ [Transform]: TransformOptions;
634
+ };
591
635
  /** Returns true if the given schema is TTuple */
592
636
  function TTuple(schema: unknown): schema is TTuple;
593
637
  /** Returns true if the given schema is TUndefined */
@@ -615,6 +659,8 @@ export declare namespace TypeGuard {
615
659
  export declare namespace ExtendsUndefined {
616
660
  function Check(schema: TSchema): boolean;
617
661
  }
662
+ export declare class TypeExtendsError extends TypeBoxError {
663
+ }
618
664
  export declare enum TypeExtendsResult {
619
665
  Union = 0,
620
666
  True = 1,
@@ -625,8 +671,10 @@ export declare namespace TypeExtends {
625
671
  }
626
672
  /** Specialized Clone for Types */
627
673
  export declare namespace TypeClone {
628
- /** Clones a type. */
629
- function Clone<T extends TSchema>(schema: T, options?: SchemaOptions): T;
674
+ /** Clones a Rest */
675
+ function Rest<T extends TSchema[]>(schemas: [...T]): T;
676
+ /** Clones a Type */
677
+ function Type<T extends TSchema>(schema: T, options?: SchemaOptions): T;
630
678
  }
631
679
  export declare namespace IndexedAccessor {
632
680
  function Resolve(schema: TSchema, keys: TPropertyKey[], options?: SchemaOptions): TSchema;
@@ -647,6 +695,8 @@ export declare namespace KeyResolver {
647
695
  /** Resolves a regular expression pattern matching all keys in this schema */
648
696
  function ResolvePattern(schema: TSchema): string;
649
697
  }
698
+ export declare class KeyArrayResolverError extends TypeBoxError {
699
+ }
650
700
  export declare namespace KeyArrayResolver {
651
701
  /** Resolves an array of string[] keys from the given schema or array type. */
652
702
  function Resolve(schema: TSchema | string[]): string[];
@@ -655,6 +705,8 @@ export declare namespace UnionResolver {
655
705
  /** Returns a resolved union with interior unions flattened */
656
706
  function Resolve(union: TUnion): TUnion;
657
707
  }
708
+ export declare class TemplateLiteralPatternError extends TypeBoxError {
709
+ }
658
710
  export declare namespace TemplateLiteralPattern {
659
711
  function Create(kinds: TTemplateLiteralKind[]): string;
660
712
  }
@@ -662,8 +714,7 @@ export declare namespace TemplateLiteralResolver {
662
714
  /** Resolves a template literal as a TUnion */
663
715
  function Resolve(template: TTemplateLiteral): TString | TUnion | TLiteral;
664
716
  }
665
- export declare class TemplateLiteralParserError extends Error {
666
- constructor(message: string);
717
+ export declare class TemplateLiteralParserError extends TypeBoxError {
667
718
  }
668
719
  export declare namespace TemplateLiteralParser {
669
720
  type Expression = And | Or | Const;
@@ -684,196 +735,219 @@ export declare namespace TemplateLiteralParser {
684
735
  /** Parses a pattern and strips forward and trailing ^ and $ */
685
736
  function ParseExact(pattern: string): Expression;
686
737
  }
738
+ export declare class TemplateLiteralFiniteError extends TypeBoxError {
739
+ }
687
740
  export declare namespace TemplateLiteralFinite {
688
741
  function Check(expression: TemplateLiteralParser.Expression): boolean;
689
742
  }
743
+ export declare class TemplateLiteralGeneratorError extends TypeBoxError {
744
+ }
690
745
  export declare namespace TemplateLiteralGenerator {
691
746
  function Generate(expression: TemplateLiteralParser.Expression): IterableIterator<string>;
692
747
  }
693
748
  export declare namespace TemplateLiteralDslParser {
694
749
  function Parse(template_dsl: string): TTemplateLiteralKind[];
695
750
  }
751
+ export declare class TransformDecodeBuilder<T extends TSchema> {
752
+ private readonly schema;
753
+ constructor(schema: T);
754
+ Decode<U extends unknown, D extends TransformFunction<StaticDecode<T>, U>>(decode: D): TransformEncodeBuilder<T, D>;
755
+ }
756
+ export declare class TransformEncodeBuilder<T extends TSchema, D extends TransformFunction> {
757
+ private readonly schema;
758
+ private readonly decode;
759
+ constructor(schema: T, decode: D);
760
+ Encode<E extends TransformFunction<ReturnType<D>, StaticDecode<T>>>(encode: E): TTransform<T, ReturnType<D>>;
761
+ }
762
+ export declare class TypeBuilderError extends TypeBoxError {
763
+ }
696
764
  export declare class TypeBuilder {
697
- /** `[Utility]` Creates a schema without `static` and `params` types */
765
+ /** `[Internal]` Creates a schema without `static` and `params` types */
698
766
  protected Create<T>(schema: Omit<T, 'static' | 'params'>): T;
699
- /** `[Utility]` Discards a property key from the given schema */
767
+ /** `[Internal]` Throws a TypeBuilder error with the given message */
768
+ protected Throw(message: string): never;
769
+ /** `[Internal]` Discards a property key from the given schema */
700
770
  protected Discard(schema: TSchema, key: PropertyKey): TSchema;
701
- /** `[Standard]` Omits compositing symbols from this schema */
771
+ /** `[Json]` Omits compositing symbols from this schema */
702
772
  Strict<T extends TSchema>(schema: T): T;
703
773
  }
704
- export declare class StandardTypeBuilder extends TypeBuilder {
705
- /** `[Standard]` Creates a Readonly and Optional property */
774
+ export declare class JsonTypeBuilder extends TypeBuilder {
775
+ /** `[Json]` Creates a Readonly and Optional property */
706
776
  ReadonlyOptional<T extends TSchema>(schema: T): TReadonly<TOptional<T>>;
707
- /** `[Standard]` Creates a Readonly property */
777
+ /** `[Json]` Creates a Readonly property */
708
778
  Readonly<T extends TSchema>(schema: T): TReadonly<T>;
709
- /** `[Standard]` Creates an Optional property */
779
+ /** `[Json]` Creates an Optional property */
710
780
  Optional<T extends TSchema>(schema: T): TOptional<T>;
711
- /** `[Standard]` Creates an Any type */
781
+ /** `[Json]` Creates an Any type */
712
782
  Any(options?: SchemaOptions): TAny;
713
- /** `[Standard]` Creates an Array type */
783
+ /** `[Json]` Creates an Array type */
714
784
  Array<T extends TSchema>(schema: T, options?: ArrayOptions): TArray<T>;
715
- /** `[Standard]` Creates a Boolean type */
785
+ /** `[Json]` Creates a Boolean type */
716
786
  Boolean(options?: SchemaOptions): TBoolean;
717
- /** `[Standard]` Intrinsic function to Capitalize LiteralString types */
787
+ /** `[Json]` Intrinsic function to Capitalize LiteralString types */
718
788
  Capitalize<T extends TSchema>(schema: T, options?: SchemaOptions): TIntrinsic<T, 'Capitalize'>;
719
- /** `[Standard]` Creates a Composite object type */
789
+ /** `[Json]` Creates a Composite object type */
720
790
  Composite<T extends TObject[]>(objects: [...T], options?: ObjectOptions): TComposite<T>;
721
- /** `[Standard]` Creates a Enum type */
791
+ /** `[Json]` Creates a Enum type */
722
792
  Enum<T extends Record<string, string | number>>(item: T, options?: SchemaOptions): TEnum<T>;
723
- /** `[Standard]` Creates a Conditional type */
793
+ /** `[Json]` Creates a Conditional type */
724
794
  Extends<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema>(left: L, right: R, trueType: T, falseType: U, options?: SchemaOptions): TExtends<L, R, T, U>;
725
- /** `[Standard]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
795
+ /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */
726
796
  Exclude<L extends TSchema, R extends TSchema>(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude<L, R>;
727
- /** `[Standard]` Constructs a type by extracting from type all union members that are assignable to union */
797
+ /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */
728
798
  Extract<L extends TSchema, R extends TSchema>(type: L, union: R, options?: SchemaOptions): TExtract<L, R>;
729
- /** `[Standard]` Returns an Indexed property type for the given keys */
730
- Index<T extends TTuple, K extends TNumber>(schema: T, keys: K, options?: SchemaOptions): UnionType<Assert<T['items'], TSchema[]>>;
731
- /** `[Standard]` Returns an Indexed property type for the given keys */
799
+ /** `[Json]` Returns an Indexed property type for the given keys */
732
800
  Index<T extends TArray, K extends TNumber>(schema: T, keys: K, options?: SchemaOptions): AssertType<T['items']>;
733
- /** `[Standard]` Returns an Indexed property type for the given keys */
801
+ /** `[Json]` Returns an Indexed property type for the given keys */
802
+ Index<T extends TTuple, K extends (keyof Static<T>)[]>(schema: T, keys: [...K], options?: SchemaOptions): TIndex<T, Assert<K, TPropertyKey[]>>;
803
+ /** `[Json]` Returns an Indexed property type for the given keys */
804
+ Index<T extends TTuple, K extends TNumber>(schema: T, keys: K, options?: SchemaOptions): UnionType<AssertRest<T['items']>>;
805
+ /** `[Json]` Returns an Indexed property type for the given keys */
734
806
  Index<T extends TSchema, K extends TTemplateLiteral>(schema: T, keys: K, options?: SchemaOptions): TIndex<T, TTemplateLiteralKeyRest<K>>;
735
- /** `[Standard]` Returns an Indexed property type for the given keys */
807
+ /** `[Json]` Returns an Indexed property type for the given keys */
736
808
  Index<T extends TSchema, K extends TLiteral<TPropertyKey>>(schema: T, keys: K, options?: SchemaOptions): TIndex<T, [K['const']]>;
737
- /** `[Standard]` Returns an Indexed property type for the given keys */
809
+ /** `[Json]` Returns an Indexed property type for the given keys */
738
810
  Index<T extends TSchema, K extends (keyof Static<T>)[]>(schema: T, keys: [...K], options?: SchemaOptions): TIndex<T, Assert<K, TPropertyKey[]>>;
739
- /** `[Standard]` Returns an Indexed property type for the given keys */
811
+ /** `[Json]` Returns an Indexed property type for the given keys */
740
812
  Index<T extends TSchema, K extends TUnion<TLiteral<TPropertyKey>[]>>(schema: T, keys: K, options?: SchemaOptions): TIndex<T, TUnionLiteralKeyRest<K>>;
741
- /** `[Standard]` Returns an Indexed property type for the given keys */
813
+ /** `[Json]` Returns an Indexed property type for the given keys */
742
814
  Index<T extends TSchema, K extends TSchema>(schema: T, key: K, options?: SchemaOptions): TSchema;
743
- /** `[Standard]` Creates an Integer type */
815
+ /** `[Json]` Creates an Integer type */
744
816
  Integer(options?: NumericOptions<number>): TInteger;
745
- /** `[Standard]` Creates an Intersect type */
817
+ /** `[Json]` Creates an Intersect type */
746
818
  Intersect(allOf: [], options?: SchemaOptions): TNever;
747
- /** `[Standard]` Creates an Intersect type */
819
+ /** `[Json]` Creates an Intersect type */
748
820
  Intersect<T extends [TSchema]>(allOf: [...T], options?: SchemaOptions): T[0];
749
- /** `[Standard]` Creates an Intersect type */
821
+ /** `[Json]` Creates an Intersect type */
750
822
  Intersect<T extends TSchema[]>(allOf: [...T], options?: IntersectOptions): TIntersect<T>;
751
- /** `[Standard]` Creates a KeyOf type */
823
+ /** `[Json]` Creates a KeyOf type */
752
824
  KeyOf<T extends TSchema>(schema: T, options?: SchemaOptions): TKeyOf<T>;
753
- /** `[Standard]` Creates a Literal type */
825
+ /** `[Json]` Creates a Literal type */
754
826
  Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>;
755
- /** `[Standard]` Intrinsic function to Lowercase LiteralString types */
827
+ /** `[Json]` Intrinsic function to Lowercase LiteralString types */
756
828
  Lowercase<T extends TSchema>(schema: T, options?: SchemaOptions): TIntrinsic<T, 'Lowercase'>;
757
- /** `[Standard]` Creates a Never type */
829
+ /** `[Json]` Creates a Never type */
758
830
  Never(options?: SchemaOptions): TNever;
759
- /** `[Standard]` Creates a Not type */
831
+ /** `[Json]` Creates a Not type */
760
832
  Not<T extends TSchema>(schema: T, options?: SchemaOptions): TNot<T>;
761
- /** `[Standard]` Creates a Null type */
833
+ /** `[Json]` Creates a Null type */
762
834
  Null(options?: SchemaOptions): TNull;
763
- /** `[Standard]` Creates a Number type */
835
+ /** `[Json]` Creates a Number type */
764
836
  Number(options?: NumericOptions<number>): TNumber;
765
- /** `[Standard]` Creates an Object type */
837
+ /** `[Json]` Creates an Object type */
766
838
  Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>;
767
- /** `[Standard]` Constructs a type whose keys are omitted from the given type */
839
+ /** `[Json]` Constructs a type whose keys are omitted from the given type */
768
840
  Omit<T extends TSchema, K extends (keyof Static<T>)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TOmit<T, K[number]>;
769
- /** `[Standard]` Constructs a type whose keys are omitted from the given type */
841
+ /** `[Json]` Constructs a type whose keys are omitted from the given type */
770
842
  Omit<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(schema: T, keys: K, options?: SchemaOptions): TOmit<T, TUnionLiteralKeyRest<K>[number]>;
771
- /** `[Standard]` Constructs a type whose keys are omitted from the given type */
843
+ /** `[Json]` Constructs a type whose keys are omitted from the given type */
772
844
  Omit<T extends TSchema, K extends TLiteral<string>>(schema: T, key: K, options?: SchemaOptions): TOmit<T, K['const']>;
773
- /** `[Standard]` Constructs a type whose keys are omitted from the given type */
845
+ /** `[Json]` Constructs a type whose keys are omitted from the given type */
774
846
  Omit<T extends TSchema, K extends TTemplateLiteral>(schema: T, key: K, options?: SchemaOptions): TOmit<T, TTemplateLiteralKeyRest<K>[number]>;
775
- /** `[Standard]` Constructs a type whose keys are omitted from the given type */
847
+ /** `[Json]` Constructs a type whose keys are omitted from the given type */
776
848
  Omit<T extends TSchema, K extends TNever>(schema: T, key: K, options?: SchemaOptions): TOmit<T, never>;
777
- /** `[Standard]` Constructs a type where all properties are optional */
849
+ /** `[Json]` Constructs a type where all properties are optional */
778
850
  Partial<T extends TSchema>(schema: T, options?: ObjectOptions): TPartial<T>;
779
- /** `[Standard]` Constructs a type whose keys are picked from the given type */
851
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
780
852
  Pick<T extends TSchema, K extends (keyof Static<T>)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TPick<T, K[number]>;
781
- /** `[Standard]` Constructs a type whose keys are picked from the given type */
853
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
782
854
  Pick<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(schema: T, keys: K, options?: SchemaOptions): TPick<T, TUnionLiteralKeyRest<K>[number]>;
783
- /** `[Standard]` Constructs a type whose keys are picked from the given type */
855
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
784
856
  Pick<T extends TSchema, K extends TLiteral<string>>(schema: T, key: K, options?: SchemaOptions): TPick<T, K['const']>;
785
- /** `[Standard]` Constructs a type whose keys are picked from the given type */
857
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
786
858
  Pick<T extends TSchema, K extends TTemplateLiteral>(schema: T, key: K, options?: SchemaOptions): TPick<T, TTemplateLiteralKeyRest<K>[number]>;
787
- /** `[Standard]` Constructs a type whose keys are picked from the given type */
859
+ /** `[Json]` Constructs a type whose keys are picked from the given type */
788
860
  Pick<T extends TSchema, K extends TNever>(schema: T, key: K, options?: SchemaOptions): TPick<T, never>;
789
- /** `[Standard]` Creates a Record type */
861
+ /** `[Json]` Creates a Record type */
790
862
  Record<K extends TUnion, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordUnionLiteralType<K, T>;
791
- /** `[Standard]` Creates a Record type */
863
+ /** `[Json]` Creates a Record type */
792
864
  Record<K extends TLiteral<string | number>, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordLiteralType<K, T>;
793
- /** `[Standard]` Creates a Record type */
865
+ /** `[Json]` Creates a Record type */
794
866
  Record<K extends TTemplateLiteral, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordTemplateLiteralType<K, T>;
795
- /** `[Standard]` Creates a Record type */
867
+ /** `[Json]` Creates a Record type */
796
868
  Record<K extends TInteger | TNumber, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordNumberType<K, T>;
797
- /** `[Standard]` Creates a Record type */
869
+ /** `[Json]` Creates a Record type */
798
870
  Record<K extends TString, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): RecordStringType<K, T>;
799
- /** `[Standard]` Creates a Recursive type */
871
+ /** `[Json]` Creates a Recursive type */
800
872
  Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
801
- /** `[Standard]` Creates a Ref type. The referenced type must contain a $id */
873
+ /** `[Json]` Creates a Ref type. The referenced type must contain a $id */
802
874
  Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>;
803
- /** `[Standard]` Creates a Ref type. */
875
+ /** `[Json]` Creates a Ref type. */
804
876
  Ref<T extends TSchema>($ref: string, options?: SchemaOptions): TRef<T>;
805
- /** `[Standard]` Constructs a type where all properties are required */
877
+ /** `[Json]` Constructs a type where all properties are required */
806
878
  Required<T extends TSchema>(schema: T, options?: SchemaOptions): TRequired<T>;
807
- /** `[Standard]` Extracts the rest array from a Tuple */
879
+ /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */
808
880
  Rest<T extends TSchema>(schema: T): TRest<T>;
809
- /** `[Standard]` Creates a String type */
881
+ /** `[Json]` Creates a String type */
810
882
  String(options?: StringOptions): TString;
811
- /** `[Standard]` Creates a TemplateLiteral type from template dsl string */
883
+ /** `[Json]` Creates a TemplateLiteral type from template dsl string */
812
884
  TemplateLiteral<T extends string>(templateDsl: T, options?: SchemaOptions): TTemplateLiteralDslParser<T>;
813
- /** `[Standard]` Creates a TemplateLiteral type */
885
+ /** `[Json]` Creates a TemplateLiteral type */
814
886
  TemplateLiteral<T extends TTemplateLiteralKind[]>(kinds: [...T], options?: SchemaOptions): TTemplateLiteral<T>;
815
- /** `[Standard]` Creates a Tuple type */
887
+ /** `[Json]` Creates a Transform type */
888
+ Transform<I extends TSchema>(schema: I): TransformDecodeBuilder<I>;
889
+ /** `[Json]` Creates a Tuple type */
816
890
  Tuple<T extends TSchema[]>(items: [...T], options?: SchemaOptions): TTuple<T>;
817
- /** `[Standard]` Intrinsic function to Uncapitalize LiteralString types */
891
+ /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */
818
892
  Uncapitalize<T extends TSchema>(schema: T, options?: SchemaOptions): TIntrinsic<T, 'Uncapitalize'>;
819
- /** `[Standard]` Creates a Union type */
893
+ /** `[Json]` Creates a Union type */
820
894
  Union(anyOf: [], options?: SchemaOptions): TNever;
821
- /** `[Standard]` Creates a Union type */
895
+ /** `[Json]` Creates a Union type */
822
896
  Union<T extends [TSchema]>(anyOf: [...T], options?: SchemaOptions): T[0];
823
- /** `[Standard]` Creates a Union type */
897
+ /** `[Json]` Creates a Union type */
824
898
  Union<T extends TSchema[]>(anyOf: [...T], options?: SchemaOptions): TUnion<T>;
825
- /** `[Experimental]` Converts a TemplateLiteral into a Union */
899
+ /** `[Json-Experimental]` Converts a TemplateLiteral into a Union */
826
900
  Union<T extends TTemplateLiteral>(template: T): TUnionTemplateLiteral<T>;
827
- /** `[Standard]` Creates an Unknown type */
901
+ /** `[Json]` Creates an Unknown type */
828
902
  Unknown(options?: SchemaOptions): TUnknown;
829
- /** `[Standard]` Creates a Unsafe type that will infers as the generic argument T */
903
+ /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */
830
904
  Unsafe<T>(options?: UnsafeOptions): TUnsafe<T>;
831
- /** `[Standard]` Intrinsic function to Uppercase LiteralString types */
905
+ /** `[Json]` Intrinsic function to Uppercase LiteralString types */
832
906
  Uppercase<T extends TSchema>(schema: T, options?: SchemaOptions): TIntrinsic<T, 'Uppercase'>;
833
907
  }
834
- export declare class ExtendedTypeBuilder extends StandardTypeBuilder {
835
- /** `[Extended]` Creates a AsyncIterator type */
908
+ export declare class JavaScriptTypeBuilder extends JsonTypeBuilder {
909
+ /** `[JavaScript]` Creates a AsyncIterator type */
836
910
  AsyncIterator<T extends TSchema>(items: T, options?: SchemaOptions): TAsyncIterator<T>;
837
- /** `[Extended]` Constructs a type by recursively unwrapping Promise types */
911
+ /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */
838
912
  Awaited<T extends TSchema>(schema: T, options?: SchemaOptions): TAwaited<T>;
839
- /** `[Extended]` Creates a BigInt type */
913
+ /** `[JavaScript]` Creates a BigInt type */
840
914
  BigInt(options?: NumericOptions<bigint>): TBigInt;
841
- /** `[Extended]` Extracts the ConstructorParameters from the given Constructor type */
915
+ /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */
842
916
  ConstructorParameters<T extends TConstructor<any[], any>>(schema: T, options?: SchemaOptions): TConstructorParameters<T>;
843
- /** `[Extended]` Creates a Constructor type */
917
+ /** `[JavaScript]` Creates a Constructor type */
844
918
  Constructor<T extends TSchema[], U extends TSchema>(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor<T, U>;
845
- /** `[Extended]` Creates a Date type */
919
+ /** `[JavaScript]` Creates a Date type */
846
920
  Date(options?: DateOptions): TDate;
847
- /** `[Extended]` Creates a Function type */
921
+ /** `[JavaScript]` Creates a Function type */
848
922
  Function<T extends TSchema[], U extends TSchema>(parameters: [...T], returns: U, options?: SchemaOptions): TFunction<T, U>;
849
- /** `[Extended]` Extracts the InstanceType from the given Constructor type */
923
+ /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */
850
924
  InstanceType<T extends TConstructor<any[], any>>(schema: T, options?: SchemaOptions): TInstanceType<T>;
851
- /** `[Extended]` Creates an Iterator type */
925
+ /** `[JavaScript]` Creates an Iterator type */
852
926
  Iterator<T extends TSchema>(items: T, options?: SchemaOptions): TIterator<T>;
853
- /** `[Extended]` Extracts the Parameters from the given Function type */
927
+ /** `[JavaScript]` Extracts the Parameters from the given Function type */
854
928
  Parameters<T extends TFunction<any[], any>>(schema: T, options?: SchemaOptions): TParameters<T>;
855
- /** `[Extended]` Creates a Promise type */
929
+ /** `[JavaScript]` Creates a Promise type */
856
930
  Promise<T extends TSchema>(item: T, options?: SchemaOptions): TPromise<T>;
857
- /** `[Extended]` Creates a String type from a Regular Expression pattern */
931
+ /** `[JavaScript]` Creates a String type from a Regular Expression pattern */
858
932
  RegExp(pattern: string, options?: SchemaOptions): TString;
859
- /** `[Extended]` Creates a String type from a Regular Expression */
933
+ /** `[JavaScript]` Creates a String type from a Regular Expression */
860
934
  RegExp(regex: RegExp, options?: SchemaOptions): TString;
861
935
  /**
862
936
  * @deprecated Use `Type.RegExp`
863
937
  */
864
938
  RegEx(regex: RegExp, options?: SchemaOptions): TString;
865
- /** `[Extended]` Extracts the ReturnType from the given Function type */
939
+ /** `[JavaScript]` Extracts the ReturnType from the given Function type */
866
940
  ReturnType<T extends TFunction<any[], any>>(schema: T, options?: SchemaOptions): TReturnType<T>;
867
- /** `[Extended]` Creates a Symbol type */
941
+ /** `[JavaScript]` Creates a Symbol type */
868
942
  Symbol(options?: SchemaOptions): TSymbol;
869
- /** `[Extended]` Creates a Undefined type */
943
+ /** `[JavaScript]` Creates a Undefined type */
870
944
  Undefined(options?: SchemaOptions): TUndefined;
871
- /** `[Extended]` Creates a Uint8Array type */
945
+ /** `[JavaScript]` Creates a Uint8Array type */
872
946
  Uint8Array(options?: Uint8ArrayOptions): TUint8Array;
873
- /** `[Extended]` Creates a Void type */
947
+ /** `[JavaScript]` Creates a Void type */
874
948
  Void(options?: SchemaOptions): TVoid;
875
949
  }
876
- /** JSON Schema Type Builder with Static Resolution for TypeScript */
877
- export declare const StandardType: StandardTypeBuilder;
878
- /** JSON Schema Type Builder with Static Resolution for TypeScript */
879
- export declare const Type: ExtendedTypeBuilder;
950
+ /** Json Type Builder with Static Resolution for TypeScript */
951
+ export declare const JsonType: JsonTypeBuilder;
952
+ /** JavaScript Type Builder with Static Resolution for TypeScript */
953
+ export declare const Type: JavaScriptTypeBuilder;