typebox 1.0.77 → 1.0.78
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/build/schema/static/if.d.mts +10 -3
- package/package.json +1 -1
|
@@ -3,6 +3,13 @@ import type { XStaticSchema } from './schema.mjs';
|
|
|
3
3
|
import type { XIf } from '../types/if.mjs';
|
|
4
4
|
import type { XElse } from '../types/else.mjs';
|
|
5
5
|
import type { XThen } from '../types/then.mjs';
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export type XStaticIf<Stack extends string[], Root extends XSchema, Schema extends XIf, IfSchema extends XSchema, If extends unknown = XStaticSchema<Stack, Root, IfSchema>, Then extends unknown = Schema extends XThen<infer ThenSchema extends XSchema> ? XStaticSchema<Stack, Root, ThenSchema> : never, Else extends unknown = Schema extends XElse<infer ElseSchema extends XSchema> ? XStaticSchema<Stack, Root, ElseSchema> : never, IsThen extends boolean = Schema extends XThen ? true : false, IsElse extends boolean = Schema extends XElse ? true : false, Result extends unknown = ([
|
|
7
|
+
IsThen,
|
|
8
|
+
IsElse
|
|
9
|
+
] extends [true, true] ? (If & Then) | Exclude<Else, If> : [
|
|
10
|
+
IsThen,
|
|
11
|
+
IsElse
|
|
12
|
+
] extends [true, false] ? (If & Then) : [
|
|
13
|
+
IsThen,
|
|
14
|
+
IsElse
|
|
15
|
+
] extends [false, true] ? Exclude<Else, If> : unknown)> = Result;
|