@sinclair/typebox 0.34.45 → 0.34.47

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.
@@ -20,10 +20,13 @@ type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProp
20
20
  }>;
21
21
  export type TPropertyKey = string | number;
22
22
  export type TProperties = Record<TPropertyKey, TSchema>;
23
- /** Creates a RequiredArray derived from the given TProperties value. */
23
+ type TIsLiteralString<Type extends string> = ([
24
+ Type
25
+ ] extends [string] ? [string] extends [Type] ? false : true : false);
26
+ type IsRequiredArrayLiteralConstant<RequiredTuple extends string[]> = (RequiredTuple extends [infer Left extends string, ...infer _ extends string[]] ? TIsLiteralString<Left> : false);
24
27
  type TRequiredArray<Properties extends TProperties, RequiredProperties extends TProperties = {
25
28
  [Key in keyof Properties as Properties[Key] extends TOptional<Properties[Key]> ? never : Key]: Properties[Key];
26
- }, RequiredKeys extends string[] = UnionToTuple<Extract<keyof RequiredProperties, string>>, Result extends string[] | undefined = RequiredKeys extends [] ? undefined : RequiredKeys> = Result;
29
+ }, RequiredUnion extends string = Extract<keyof RequiredProperties, string>, RequiredTuple extends string[] = UnionToTuple<RequiredUnion>, Result extends string[] | undefined = (IsRequiredArrayLiteralConstant<RequiredTuple> extends true ? RequiredTuple : string[] | undefined)> = Result;
27
30
  export type TAdditionalProperties = undefined | TSchema | boolean;
28
31
  export interface ObjectOptions extends SchemaOptions {
29
32
  /** Additional property constraints for this object */
@@ -20,10 +20,13 @@ type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProp
20
20
  }>;
21
21
  export type TPropertyKey = string | number;
22
22
  export type TProperties = Record<TPropertyKey, TSchema>;
23
- /** Creates a RequiredArray derived from the given TProperties value. */
23
+ type TIsLiteralString<Type extends string> = ([
24
+ Type
25
+ ] extends [string] ? [string] extends [Type] ? false : true : false);
26
+ type IsRequiredArrayLiteralConstant<RequiredTuple extends string[]> = (RequiredTuple extends [infer Left extends string, ...infer _ extends string[]] ? TIsLiteralString<Left> : false);
24
27
  type TRequiredArray<Properties extends TProperties, RequiredProperties extends TProperties = {
25
28
  [Key in keyof Properties as Properties[Key] extends TOptional<Properties[Key]> ? never : Key]: Properties[Key];
26
- }, RequiredKeys extends string[] = UnionToTuple<Extract<keyof RequiredProperties, string>>, Result extends string[] | undefined = RequiredKeys extends [] ? undefined : RequiredKeys> = Result;
29
+ }, RequiredUnion extends string = Extract<keyof RequiredProperties, string>, RequiredTuple extends string[] = UnionToTuple<RequiredUnion>, Result extends string[] | undefined = (IsRequiredArrayLiteralConstant<RequiredTuple> extends true ? RequiredTuple : string[] | undefined)> = Result;
27
30
  export type TAdditionalProperties = undefined | TSchema | boolean;
28
31
  export interface ObjectOptions extends SchemaOptions {
29
32
  /** Additional property constraints for this object */
package/license CHANGED
@@ -4,7 +4,7 @@ Json Schema Type Builder with Static Type Resolution for TypeScript
4
4
 
5
5
  The MIT License (MIT)
6
6
 
7
- Copyright (c) 2017-2025 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
8
 
9
9
  Permission is hereby granted, free of charge, to any person obtaining a copy
10
10
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.34.45",
3
+ "version": "0.34.47",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",