@sinclair/typebox 0.34.44 → 0.34.46
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
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
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
|
-
},
|
|
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/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<p>Json Schema Type Builder with Static Type Resolution for TypeScript</p>
|
|
6
6
|
|
|
7
|
-
<img src="https://raw.githubusercontent.com/sinclairzx81/typebox/refs/heads/
|
|
7
|
+
<img src="https://raw.githubusercontent.com/sinclairzx81/typebox-legacy/refs/heads/main/typebox.png" />
|
|
8
8
|
|
|
9
9
|
<br />
|
|
10
10
|
<br />
|