@sinclair/typebox 0.32.0-dev-18 → 0.32.0-dev-19
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/import/compiler/compiler.mjs +14 -8
- package/build/import/errors/errors.mjs +15 -11
- package/build/import/type/awaited/awaited.mjs +4 -4
- package/build/import/type/deref/deref.mjs +12 -12
- package/build/import/type/exclude/exclude.mjs +8 -5
- package/build/import/type/extends/extends-check.mjs +167 -167
- package/build/import/type/extends/extends.mjs +3 -3
- package/build/import/type/extract/extract.mjs +5 -5
- package/build/import/type/guard/type.d.mts +50 -50
- package/build/import/type/guard/type.mjs +136 -136
- package/build/import/type/indexed/indexed-property-keys.mjs +7 -7
- package/build/import/type/indexed/indexed.mjs +9 -9
- package/build/import/type/intersect/intersect-create.mjs +4 -4
- package/build/import/type/intersect/intersect-evaluated.mjs +1 -1
- package/build/import/type/intersect/intersect.mjs +2 -2
- package/build/import/type/intrinsic/intrinsic.mjs +5 -5
- package/build/import/type/keyof/keyof-property-keys.mjs +7 -7
- package/build/import/type/keyof/keyof.mjs +2 -2
- package/build/import/type/mapped/mapped.mjs +16 -16
- package/build/import/type/modifiers/modifiers.mjs +3 -3
- package/build/import/type/object/object.mjs +3 -3
- package/build/import/type/omit/omit.mjs +6 -6
- package/build/import/type/partial/partial.mjs +5 -5
- package/build/import/type/pick/pick.mjs +6 -6
- package/build/import/type/record/record.mjs +7 -7
- package/build/import/type/required/required.mjs +5 -5
- package/build/import/type/rest/rest.mjs +6 -2
- package/build/import/type/template-literal/pattern.mjs +9 -9
- package/build/import/type/transform/transform.mjs +1 -1
- package/build/import/type/union/union-evaluated.mjs +2 -2
- package/build/import/value/check/check.mjs +18 -11
- package/build/import/value/clean/clean.mjs +9 -7
- package/build/import/value/clone/clone.mjs +7 -4
- package/build/import/value/convert/convert.mjs +6 -2
- package/build/import/value/default/default.mjs +12 -4
- package/build/import/value/transform/decode.mjs +12 -6
- package/build/import/value/transform/encode.mjs +12 -6
- package/build/import/value/transform/has.mjs +24 -18
- package/build/require/compiler/compiler.js +77 -71
- package/build/require/errors/errors.js +58 -54
- package/build/require/type/awaited/awaited.js +3 -3
- package/build/require/type/deref/deref.js +11 -11
- package/build/require/type/exclude/exclude.js +7 -4
- package/build/require/type/extends/extends-check.js +167 -167
- package/build/require/type/extends/extends.js +2 -2
- package/build/require/type/extract/extract.js +4 -4
- package/build/require/type/guard/type.d.ts +50 -50
- package/build/require/type/guard/type.js +184 -184
- package/build/require/type/indexed/indexed-property-keys.js +6 -6
- package/build/require/type/indexed/indexed.js +9 -9
- package/build/require/type/intersect/intersect-create.js +3 -3
- package/build/require/type/intersect/intersect-evaluated.js +2 -2
- package/build/require/type/intersect/intersect.js +1 -1
- package/build/require/type/intrinsic/intrinsic.js +4 -4
- package/build/require/type/keyof/keyof-property-keys.js +6 -6
- package/build/require/type/keyof/keyof.js +1 -1
- package/build/require/type/mapped/mapped.js +15 -15
- package/build/require/type/modifiers/modifiers.js +2 -2
- package/build/require/type/object/object.js +2 -2
- package/build/require/type/omit/omit.js +5 -5
- package/build/require/type/partial/partial.js +4 -4
- package/build/require/type/pick/pick.js +5 -5
- package/build/require/type/record/record.js +6 -6
- package/build/require/type/required/required.js +4 -4
- package/build/require/type/rest/rest.js +5 -1
- package/build/require/type/template-literal/pattern.js +8 -8
- package/build/require/type/transform/transform.js +1 -1
- package/build/require/type/union/union-evaluated.js +1 -1
- package/build/require/value/check/check.js +63 -56
- package/build/require/value/clean/clean.js +31 -29
- package/build/require/value/clone/clone.js +7 -4
- package/build/require/value/convert/convert.js +42 -38
- package/build/require/value/default/default.js +24 -16
- package/build/require/value/transform/decode.js +27 -21
- package/build/require/value/transform/encode.js +28 -22
- package/build/require/value/transform/has.js +29 -23
- package/package.json +1 -1
- package/readme.md +5 -5
|
@@ -39,19 +39,19 @@ function Throw(message) {
|
|
|
39
39
|
// ------------------------------------------------------------------
|
|
40
40
|
// prettier-ignore
|
|
41
41
|
function IsStructuralRight(right) {
|
|
42
|
-
return (index_9.TypeGuard.
|
|
43
|
-
index_9.TypeGuard.
|
|
44
|
-
index_9.TypeGuard.
|
|
45
|
-
index_9.TypeGuard.
|
|
46
|
-
index_9.TypeGuard.
|
|
42
|
+
return (index_9.TypeGuard.IsNever(right) ||
|
|
43
|
+
index_9.TypeGuard.IsIntersect(right) ||
|
|
44
|
+
index_9.TypeGuard.IsUnion(right) ||
|
|
45
|
+
index_9.TypeGuard.IsUnknown(right) ||
|
|
46
|
+
index_9.TypeGuard.IsAny(right));
|
|
47
47
|
}
|
|
48
48
|
// prettier-ignore
|
|
49
49
|
function StructuralRight(left, right) {
|
|
50
|
-
return (index_9.TypeGuard.
|
|
51
|
-
index_9.TypeGuard.
|
|
52
|
-
index_9.TypeGuard.
|
|
53
|
-
index_9.TypeGuard.
|
|
54
|
-
index_9.TypeGuard.
|
|
50
|
+
return (index_9.TypeGuard.IsNever(right) ? TNeverRight(left, right) :
|
|
51
|
+
index_9.TypeGuard.IsIntersect(right) ? TIntersectRight(left, right) :
|
|
52
|
+
index_9.TypeGuard.IsUnion(right) ? TUnionRight(left, right) :
|
|
53
|
+
index_9.TypeGuard.IsUnknown(right) ? TUnknownRight(left, right) :
|
|
54
|
+
index_9.TypeGuard.IsAny(right) ? TAnyRight(left, right) :
|
|
55
55
|
Throw('StructuralRight'));
|
|
56
56
|
}
|
|
57
57
|
// ------------------------------------------------------------------
|
|
@@ -63,11 +63,11 @@ function TAnyRight(left, right) {
|
|
|
63
63
|
}
|
|
64
64
|
// prettier-ignore
|
|
65
65
|
function TAny(left, right) {
|
|
66
|
-
return (index_9.TypeGuard.
|
|
67
|
-
(index_9.TypeGuard.
|
|
68
|
-
index_9.TypeGuard.
|
|
69
|
-
index_9.TypeGuard.
|
|
70
|
-
index_9.TypeGuard.
|
|
66
|
+
return (index_9.TypeGuard.IsIntersect(right) ? TIntersectRight(left, right) :
|
|
67
|
+
(index_9.TypeGuard.IsUnion(right) && right.anyOf.some((schema) => index_9.TypeGuard.IsAny(schema) || index_9.TypeGuard.IsUnknown(schema))) ? ExtendsResult.True :
|
|
68
|
+
index_9.TypeGuard.IsUnion(right) ? ExtendsResult.Union :
|
|
69
|
+
index_9.TypeGuard.IsUnknown(right) ? ExtendsResult.True :
|
|
70
|
+
index_9.TypeGuard.IsAny(right) ? ExtendsResult.True :
|
|
71
71
|
ExtendsResult.Union);
|
|
72
72
|
}
|
|
73
73
|
// ------------------------------------------------------------------
|
|
@@ -75,16 +75,16 @@ function TAny(left, right) {
|
|
|
75
75
|
// ------------------------------------------------------------------
|
|
76
76
|
// prettier-ignore
|
|
77
77
|
function TArrayRight(left, right) {
|
|
78
|
-
return (index_9.TypeGuard.
|
|
79
|
-
index_9.TypeGuard.
|
|
80
|
-
index_9.TypeGuard.
|
|
78
|
+
return (index_9.TypeGuard.IsUnknown(left) ? ExtendsResult.False :
|
|
79
|
+
index_9.TypeGuard.IsAny(left) ? ExtendsResult.Union :
|
|
80
|
+
index_9.TypeGuard.IsNever(left) ? ExtendsResult.True :
|
|
81
81
|
ExtendsResult.False);
|
|
82
82
|
}
|
|
83
83
|
// prettier-ignore
|
|
84
84
|
function TArray(left, right) {
|
|
85
|
-
return (index_9.TypeGuard.
|
|
85
|
+
return (index_9.TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True :
|
|
86
86
|
IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
87
|
-
!index_9.TypeGuard.
|
|
87
|
+
!index_9.TypeGuard.IsArray(right) ? ExtendsResult.False :
|
|
88
88
|
IntoBooleanResult(Visit(left.items, right.items)));
|
|
89
89
|
}
|
|
90
90
|
// ------------------------------------------------------------------
|
|
@@ -93,7 +93,7 @@ function TArray(left, right) {
|
|
|
93
93
|
// prettier-ignore
|
|
94
94
|
function TAsyncIterator(left, right) {
|
|
95
95
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
96
|
-
!index_9.TypeGuard.
|
|
96
|
+
!index_9.TypeGuard.IsAsyncIterator(right) ? ExtendsResult.False :
|
|
97
97
|
IntoBooleanResult(Visit(left.items, right.items)));
|
|
98
98
|
}
|
|
99
99
|
// ------------------------------------------------------------------
|
|
@@ -102,9 +102,9 @@ function TAsyncIterator(left, right) {
|
|
|
102
102
|
// prettier-ignore
|
|
103
103
|
function TBigInt(left, right) {
|
|
104
104
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
105
|
-
index_9.TypeGuard.
|
|
106
|
-
index_9.TypeGuard.
|
|
107
|
-
index_9.TypeGuard.
|
|
105
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
106
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
107
|
+
index_9.TypeGuard.IsBigInt(right) ? ExtendsResult.True :
|
|
108
108
|
ExtendsResult.False);
|
|
109
109
|
}
|
|
110
110
|
// ------------------------------------------------------------------
|
|
@@ -112,16 +112,16 @@ function TBigInt(left, right) {
|
|
|
112
112
|
// ------------------------------------------------------------------
|
|
113
113
|
// prettier-ignore
|
|
114
114
|
function TBooleanRight(left, right) {
|
|
115
|
-
return (index_9.TypeGuard.
|
|
116
|
-
index_9.TypeGuard.
|
|
115
|
+
return (index_9.TypeGuard.IsLiteralBoolean(left) ? ExtendsResult.True :
|
|
116
|
+
index_9.TypeGuard.IsBoolean(left) ? ExtendsResult.True :
|
|
117
117
|
ExtendsResult.False);
|
|
118
118
|
}
|
|
119
119
|
// prettier-ignore
|
|
120
120
|
function TBoolean(left, right) {
|
|
121
121
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
122
|
-
index_9.TypeGuard.
|
|
123
|
-
index_9.TypeGuard.
|
|
124
|
-
index_9.TypeGuard.
|
|
122
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
123
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
124
|
+
index_9.TypeGuard.IsBoolean(right) ? ExtendsResult.True :
|
|
125
125
|
ExtendsResult.False);
|
|
126
126
|
}
|
|
127
127
|
// ------------------------------------------------------------------
|
|
@@ -130,8 +130,8 @@ function TBoolean(left, right) {
|
|
|
130
130
|
// prettier-ignore
|
|
131
131
|
function TConstructor(left, right) {
|
|
132
132
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
133
|
-
index_9.TypeGuard.
|
|
134
|
-
!index_9.TypeGuard.
|
|
133
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
134
|
+
!index_9.TypeGuard.IsConstructor(right) ? ExtendsResult.False :
|
|
135
135
|
left.parameters.length > right.parameters.length ? ExtendsResult.False :
|
|
136
136
|
(!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False :
|
|
137
137
|
IntoBooleanResult(Visit(left.returns, right.returns)));
|
|
@@ -142,9 +142,9 @@ function TConstructor(left, right) {
|
|
|
142
142
|
// prettier-ignore
|
|
143
143
|
function TDate(left, right) {
|
|
144
144
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
145
|
-
index_9.TypeGuard.
|
|
146
|
-
index_9.TypeGuard.
|
|
147
|
-
index_9.TypeGuard.
|
|
145
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
146
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
147
|
+
index_9.TypeGuard.IsDate(right) ? ExtendsResult.True :
|
|
148
148
|
ExtendsResult.False);
|
|
149
149
|
}
|
|
150
150
|
// ------------------------------------------------------------------
|
|
@@ -153,8 +153,8 @@ function TDate(left, right) {
|
|
|
153
153
|
// prettier-ignore
|
|
154
154
|
function TFunction(left, right) {
|
|
155
155
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
156
|
-
index_9.TypeGuard.
|
|
157
|
-
!index_9.TypeGuard.
|
|
156
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
157
|
+
!index_9.TypeGuard.IsFunction(right) ? ExtendsResult.False :
|
|
158
158
|
left.parameters.length > right.parameters.length ? ExtendsResult.False :
|
|
159
159
|
(!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False :
|
|
160
160
|
IntoBooleanResult(Visit(left.returns, right.returns)));
|
|
@@ -164,16 +164,16 @@ function TFunction(left, right) {
|
|
|
164
164
|
// ------------------------------------------------------------------
|
|
165
165
|
// prettier-ignore
|
|
166
166
|
function TIntegerRight(left, right) {
|
|
167
|
-
return (index_9.TypeGuard.
|
|
168
|
-
index_9.TypeGuard.
|
|
167
|
+
return (index_9.TypeGuard.IsLiteral(left) && index_9.ValueGuard.IsNumber(left.const) ? ExtendsResult.True :
|
|
168
|
+
index_9.TypeGuard.IsNumber(left) || index_9.TypeGuard.IsInteger(left) ? ExtendsResult.True :
|
|
169
169
|
ExtendsResult.False);
|
|
170
170
|
}
|
|
171
171
|
// prettier-ignore
|
|
172
172
|
function TInteger(left, right) {
|
|
173
|
-
return (index_9.TypeGuard.
|
|
173
|
+
return (index_9.TypeGuard.IsInteger(right) || index_9.TypeGuard.IsNumber(right) ? ExtendsResult.True :
|
|
174
174
|
IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
175
|
-
index_9.TypeGuard.
|
|
176
|
-
index_9.TypeGuard.
|
|
175
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
176
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
177
177
|
ExtendsResult.False);
|
|
178
178
|
}
|
|
179
179
|
// ------------------------------------------------------------------
|
|
@@ -197,7 +197,7 @@ function TIntersect(left, right) {
|
|
|
197
197
|
// prettier-ignore
|
|
198
198
|
function TIterator(left, right) {
|
|
199
199
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
200
|
-
!index_9.TypeGuard.
|
|
200
|
+
!index_9.TypeGuard.IsIterator(right) ? ExtendsResult.False :
|
|
201
201
|
IntoBooleanResult(Visit(left.items, right.items)));
|
|
202
202
|
}
|
|
203
203
|
// ------------------------------------------------------------------
|
|
@@ -205,14 +205,14 @@ function TIterator(left, right) {
|
|
|
205
205
|
// ------------------------------------------------------------------
|
|
206
206
|
// prettier-ignore
|
|
207
207
|
function TLiteral(left, right) {
|
|
208
|
-
return (index_9.TypeGuard.
|
|
208
|
+
return (index_9.TypeGuard.IsLiteral(right) && right.const === left.const ? ExtendsResult.True :
|
|
209
209
|
IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
210
|
-
index_9.TypeGuard.
|
|
211
|
-
index_9.TypeGuard.
|
|
212
|
-
index_9.TypeGuard.
|
|
213
|
-
index_9.TypeGuard.
|
|
214
|
-
index_9.TypeGuard.
|
|
215
|
-
index_9.TypeGuard.
|
|
210
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
211
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
212
|
+
index_9.TypeGuard.IsString(right) ? TStringRight(left, right) :
|
|
213
|
+
index_9.TypeGuard.IsNumber(right) ? TNumberRight(left, right) :
|
|
214
|
+
index_9.TypeGuard.IsInteger(right) ? TIntegerRight(left, right) :
|
|
215
|
+
index_9.TypeGuard.IsBoolean(right) ? TBooleanRight(left, right) :
|
|
216
216
|
ExtendsResult.False);
|
|
217
217
|
}
|
|
218
218
|
// ------------------------------------------------------------------
|
|
@@ -233,7 +233,7 @@ function TNever(left, right) {
|
|
|
233
233
|
function UnwrapTNot(schema) {
|
|
234
234
|
let [current, depth] = [schema, 0];
|
|
235
235
|
while (true) {
|
|
236
|
-
if (!index_9.TypeGuard.
|
|
236
|
+
if (!index_9.TypeGuard.IsNot(current))
|
|
237
237
|
break;
|
|
238
238
|
current = current.not;
|
|
239
239
|
depth += 1;
|
|
@@ -246,8 +246,8 @@ function TNot(left, right) {
|
|
|
246
246
|
// type at runtime would put TypeBox at odds with TypeScripts ability to statically infer
|
|
247
247
|
// the type. Instead we unwrap to either unknown or T and continue evaluating.
|
|
248
248
|
// prettier-ignore
|
|
249
|
-
return (index_9.TypeGuard.
|
|
250
|
-
index_9.TypeGuard.
|
|
249
|
+
return (index_9.TypeGuard.IsNot(left) ? Visit(UnwrapTNot(left), right) :
|
|
250
|
+
index_9.TypeGuard.IsNot(right) ? Visit(left, UnwrapTNot(right)) :
|
|
251
251
|
Throw('Invalid fallthrough for Not'));
|
|
252
252
|
}
|
|
253
253
|
// ------------------------------------------------------------------
|
|
@@ -256,9 +256,9 @@ function TNot(left, right) {
|
|
|
256
256
|
// prettier-ignore
|
|
257
257
|
function TNull(left, right) {
|
|
258
258
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
259
|
-
index_9.TypeGuard.
|
|
260
|
-
index_9.TypeGuard.
|
|
261
|
-
index_9.TypeGuard.
|
|
259
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
260
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
261
|
+
index_9.TypeGuard.IsNull(right) ? ExtendsResult.True :
|
|
262
262
|
ExtendsResult.False);
|
|
263
263
|
}
|
|
264
264
|
// ------------------------------------------------------------------
|
|
@@ -266,16 +266,16 @@ function TNull(left, right) {
|
|
|
266
266
|
// ------------------------------------------------------------------
|
|
267
267
|
// prettier-ignore
|
|
268
268
|
function TNumberRight(left, right) {
|
|
269
|
-
return (index_9.TypeGuard.
|
|
270
|
-
index_9.TypeGuard.
|
|
269
|
+
return (index_9.TypeGuard.IsLiteralNumber(left) ? ExtendsResult.True :
|
|
270
|
+
index_9.TypeGuard.IsNumber(left) || index_9.TypeGuard.IsInteger(left) ? ExtendsResult.True :
|
|
271
271
|
ExtendsResult.False);
|
|
272
272
|
}
|
|
273
273
|
// prettier-ignore
|
|
274
274
|
function TNumber(left, right) {
|
|
275
275
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
276
|
-
index_9.TypeGuard.
|
|
277
|
-
index_9.TypeGuard.
|
|
278
|
-
index_9.TypeGuard.
|
|
276
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
277
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
278
|
+
index_9.TypeGuard.IsInteger(right) || index_9.TypeGuard.IsNumber(right) ? ExtendsResult.True :
|
|
279
279
|
ExtendsResult.False);
|
|
280
280
|
}
|
|
281
281
|
// ------------------------------------------------------------------
|
|
@@ -291,9 +291,9 @@ function IsObjectStringLike(schema) {
|
|
|
291
291
|
}
|
|
292
292
|
// prettier-ignore
|
|
293
293
|
function IsObjectSymbolLike(schema) {
|
|
294
|
-
return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'description' in schema.properties && index_9.TypeGuard.
|
|
295
|
-
index_9.TypeGuard.
|
|
296
|
-
index_9.TypeGuard.
|
|
294
|
+
return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'description' in schema.properties && index_9.TypeGuard.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && ((index_9.TypeGuard.IsString(schema.properties.description.anyOf[0]) &&
|
|
295
|
+
index_9.TypeGuard.IsUndefined(schema.properties.description.anyOf[1])) || (index_9.TypeGuard.IsString(schema.properties.description.anyOf[1]) &&
|
|
296
|
+
index_9.TypeGuard.IsUndefined(schema.properties.description.anyOf[0]))));
|
|
297
297
|
}
|
|
298
298
|
// prettier-ignore
|
|
299
299
|
function IsObjectNumberLike(schema) {
|
|
@@ -340,33 +340,33 @@ function IsObjectPromiseLike(schema) {
|
|
|
340
340
|
// prettier-ignore
|
|
341
341
|
function Property(left, right) {
|
|
342
342
|
return (Visit(left, right) === ExtendsResult.False ? ExtendsResult.False :
|
|
343
|
-
index_9.TypeGuard.
|
|
343
|
+
index_9.TypeGuard.IsOptional(left) && !index_9.TypeGuard.IsOptional(right) ? ExtendsResult.False :
|
|
344
344
|
ExtendsResult.True);
|
|
345
345
|
}
|
|
346
346
|
// prettier-ignore
|
|
347
347
|
function TObjectRight(left, right) {
|
|
348
|
-
return (index_9.TypeGuard.
|
|
349
|
-
index_9.TypeGuard.
|
|
350
|
-
(index_9.TypeGuard.
|
|
351
|
-
(index_9.TypeGuard.
|
|
352
|
-
(index_9.TypeGuard.
|
|
353
|
-
(index_9.TypeGuard.
|
|
354
|
-
(index_9.TypeGuard.
|
|
355
|
-
(index_9.TypeGuard.
|
|
356
|
-
(index_9.TypeGuard.
|
|
357
|
-
(index_9.TypeGuard.
|
|
358
|
-
(index_9.TypeGuard.
|
|
359
|
-
(index_9.TypeGuard.
|
|
360
|
-
(index_9.TypeGuard.
|
|
361
|
-
(index_9.TypeGuard.
|
|
362
|
-
(index_9.TypeGuard.
|
|
363
|
-
(index_9.TypeGuard.
|
|
364
|
-
(index_9.TypeGuard.
|
|
348
|
+
return (index_9.TypeGuard.IsUnknown(left) ? ExtendsResult.False :
|
|
349
|
+
index_9.TypeGuard.IsAny(left) ? ExtendsResult.Union : (index_9.TypeGuard.IsNever(left) ||
|
|
350
|
+
(index_9.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right)) ||
|
|
351
|
+
(index_9.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right)) ||
|
|
352
|
+
(index_9.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right)) ||
|
|
353
|
+
(index_9.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) ||
|
|
354
|
+
(index_9.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right)) ||
|
|
355
|
+
(index_9.TypeGuard.IsString(left) && IsObjectStringLike(right)) ||
|
|
356
|
+
(index_9.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) ||
|
|
357
|
+
(index_9.TypeGuard.IsNumber(left) && IsObjectNumberLike(right)) ||
|
|
358
|
+
(index_9.TypeGuard.IsInteger(left) && IsObjectNumberLike(right)) ||
|
|
359
|
+
(index_9.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right)) ||
|
|
360
|
+
(index_9.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right)) ||
|
|
361
|
+
(index_9.TypeGuard.IsDate(left) && IsObjectDateLike(right)) ||
|
|
362
|
+
(index_9.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right)) ||
|
|
363
|
+
(index_9.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right))) ? ExtendsResult.True :
|
|
364
|
+
(index_9.TypeGuard.IsRecord(left) && index_9.TypeGuard.IsString(RecordKey(left))) ? (() => {
|
|
365
365
|
// When expressing a Record with literal key values, the Record is converted into a Object with
|
|
366
366
|
// the Hint assigned as `Record`. This is used to invert the extends logic.
|
|
367
367
|
return right[index_8.Hint] === 'Record' ? ExtendsResult.True : ExtendsResult.False;
|
|
368
368
|
})() :
|
|
369
|
-
(index_9.TypeGuard.
|
|
369
|
+
(index_9.TypeGuard.IsRecord(left) && index_9.TypeGuard.IsNumber(RecordKey(left))) ? (() => {
|
|
370
370
|
return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
|
|
371
371
|
})() :
|
|
372
372
|
ExtendsResult.False);
|
|
@@ -374,14 +374,14 @@ function TObjectRight(left, right) {
|
|
|
374
374
|
// prettier-ignore
|
|
375
375
|
function TObject(left, right) {
|
|
376
376
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
377
|
-
index_9.TypeGuard.
|
|
378
|
-
!index_9.TypeGuard.
|
|
377
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
378
|
+
!index_9.TypeGuard.IsObject(right) ? ExtendsResult.False :
|
|
379
379
|
(() => {
|
|
380
380
|
for (const key of Object.getOwnPropertyNames(right.properties)) {
|
|
381
|
-
if (!(key in left.properties) && !index_9.TypeGuard.
|
|
381
|
+
if (!(key in left.properties) && !index_9.TypeGuard.IsOptional(right.properties[key])) {
|
|
382
382
|
return ExtendsResult.False;
|
|
383
383
|
}
|
|
384
|
-
if (index_9.TypeGuard.
|
|
384
|
+
if (index_9.TypeGuard.IsOptional(right.properties[key])) {
|
|
385
385
|
return ExtendsResult.True;
|
|
386
386
|
}
|
|
387
387
|
if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
|
|
@@ -397,8 +397,8 @@ function TObject(left, right) {
|
|
|
397
397
|
// prettier-ignore
|
|
398
398
|
function TPromise(left, right) {
|
|
399
399
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
400
|
-
index_9.TypeGuard.
|
|
401
|
-
!index_9.TypeGuard.
|
|
400
|
+
index_9.TypeGuard.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True :
|
|
401
|
+
!index_9.TypeGuard.IsPromise(right) ? ExtendsResult.False :
|
|
402
402
|
IntoBooleanResult(Visit(left.item, right.item)));
|
|
403
403
|
}
|
|
404
404
|
// ------------------------------------------------------------------
|
|
@@ -419,11 +419,11 @@ function RecordValue(schema) {
|
|
|
419
419
|
// prettier-ignore
|
|
420
420
|
function TRecordRight(left, right) {
|
|
421
421
|
const [Key, Value] = [RecordKey(right), RecordValue(right)];
|
|
422
|
-
return ((index_9.TypeGuard.
|
|
423
|
-
index_9.TypeGuard.
|
|
424
|
-
index_9.TypeGuard.
|
|
425
|
-
index_9.TypeGuard.
|
|
426
|
-
index_9.TypeGuard.
|
|
422
|
+
return ((index_9.TypeGuard.IsLiteralString(left) && index_9.TypeGuard.IsNumber(Key) && IntoBooleanResult(Visit(left, Value)) === ExtendsResult.True) ? ExtendsResult.True :
|
|
423
|
+
index_9.TypeGuard.IsUint8Array(left) && index_9.TypeGuard.IsNumber(Key) ? Visit(left, Value) :
|
|
424
|
+
index_9.TypeGuard.IsString(left) && index_9.TypeGuard.IsNumber(Key) ? Visit(left, Value) :
|
|
425
|
+
index_9.TypeGuard.IsArray(left) && index_9.TypeGuard.IsNumber(Key) ? Visit(left, Value) :
|
|
426
|
+
index_9.TypeGuard.IsObject(left) ? (() => {
|
|
427
427
|
for (const key of Object.getOwnPropertyNames(left.properties)) {
|
|
428
428
|
if (Property(Value, left.properties[key]) === ExtendsResult.False) {
|
|
429
429
|
return ExtendsResult.False;
|
|
@@ -436,8 +436,8 @@ function TRecordRight(left, right) {
|
|
|
436
436
|
// prettier-ignore
|
|
437
437
|
function TRecord(left, right) {
|
|
438
438
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
439
|
-
index_9.TypeGuard.
|
|
440
|
-
!index_9.TypeGuard.
|
|
439
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
440
|
+
!index_9.TypeGuard.IsRecord(right) ? ExtendsResult.False :
|
|
441
441
|
Visit(RecordValue(left), RecordValue(right)));
|
|
442
442
|
}
|
|
443
443
|
// ------------------------------------------------------------------
|
|
@@ -445,16 +445,16 @@ function TRecord(left, right) {
|
|
|
445
445
|
// ------------------------------------------------------------------
|
|
446
446
|
// prettier-ignore
|
|
447
447
|
function TStringRight(left, right) {
|
|
448
|
-
return (index_9.TypeGuard.
|
|
449
|
-
index_9.TypeGuard.
|
|
448
|
+
return (index_9.TypeGuard.IsLiteral(left) && index_9.ValueGuard.IsString(left.const) ? ExtendsResult.True :
|
|
449
|
+
index_9.TypeGuard.IsString(left) ? ExtendsResult.True :
|
|
450
450
|
ExtendsResult.False);
|
|
451
451
|
}
|
|
452
452
|
// prettier-ignore
|
|
453
453
|
function TString(left, right) {
|
|
454
454
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
455
|
-
index_9.TypeGuard.
|
|
456
|
-
index_9.TypeGuard.
|
|
457
|
-
index_9.TypeGuard.
|
|
455
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
456
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
457
|
+
index_9.TypeGuard.IsString(right) ? ExtendsResult.True :
|
|
458
458
|
ExtendsResult.False);
|
|
459
459
|
}
|
|
460
460
|
// ------------------------------------------------------------------
|
|
@@ -463,9 +463,9 @@ function TString(left, right) {
|
|
|
463
463
|
// prettier-ignore
|
|
464
464
|
function TSymbol(left, right) {
|
|
465
465
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
466
|
-
index_9.TypeGuard.
|
|
467
|
-
index_9.TypeGuard.
|
|
468
|
-
index_9.TypeGuard.
|
|
466
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
467
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
468
|
+
index_9.TypeGuard.IsSymbol(right) ? ExtendsResult.True :
|
|
469
469
|
ExtendsResult.False);
|
|
470
470
|
}
|
|
471
471
|
// ------------------------------------------------------------------
|
|
@@ -476,8 +476,8 @@ function TTemplateLiteral(left, right) {
|
|
|
476
476
|
// TemplateLiteral types are resolved to either unions for finite expressions or string
|
|
477
477
|
// for infinite expressions. Here we call to TemplateLiteralResolver to resolve for
|
|
478
478
|
// either type and continue evaluating.
|
|
479
|
-
return (index_9.TypeGuard.
|
|
480
|
-
index_9.TypeGuard.
|
|
479
|
+
return (index_9.TypeGuard.IsTemplateLiteral(left) ? Visit((0, index_6.TemplateLiteralToUnion)(left), right) :
|
|
480
|
+
index_9.TypeGuard.IsTemplateLiteral(right) ? Visit(left, (0, index_6.TemplateLiteralToUnion)(right)) :
|
|
481
481
|
Throw('Invalid fallthrough for TemplateLiteral'));
|
|
482
482
|
}
|
|
483
483
|
// ------------------------------------------------------------------
|
|
@@ -485,23 +485,23 @@ function TTemplateLiteral(left, right) {
|
|
|
485
485
|
// ------------------------------------------------------------------
|
|
486
486
|
// prettier-ignore
|
|
487
487
|
function IsArrayOfTuple(left, right) {
|
|
488
|
-
return (index_9.TypeGuard.
|
|
488
|
+
return (index_9.TypeGuard.IsArray(right) &&
|
|
489
489
|
left.items !== undefined &&
|
|
490
490
|
left.items.every((schema) => Visit(schema, right.items) === ExtendsResult.True));
|
|
491
491
|
}
|
|
492
492
|
// prettier-ignore
|
|
493
493
|
function TTupleRight(left, right) {
|
|
494
|
-
return (index_9.TypeGuard.
|
|
495
|
-
index_9.TypeGuard.
|
|
496
|
-
index_9.TypeGuard.
|
|
494
|
+
return (index_9.TypeGuard.IsNever(left) ? ExtendsResult.True :
|
|
495
|
+
index_9.TypeGuard.IsUnknown(left) ? ExtendsResult.False :
|
|
496
|
+
index_9.TypeGuard.IsAny(left) ? ExtendsResult.Union :
|
|
497
497
|
ExtendsResult.False);
|
|
498
498
|
}
|
|
499
499
|
// prettier-ignore
|
|
500
500
|
function TTuple(left, right) {
|
|
501
501
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
502
|
-
index_9.TypeGuard.
|
|
503
|
-
index_9.TypeGuard.
|
|
504
|
-
!index_9.TypeGuard.
|
|
502
|
+
index_9.TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True :
|
|
503
|
+
index_9.TypeGuard.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True :
|
|
504
|
+
!index_9.TypeGuard.IsTuple(right) ? ExtendsResult.False :
|
|
505
505
|
(index_9.ValueGuard.IsUndefined(left.items) && !index_9.ValueGuard.IsUndefined(right.items)) || (!index_9.ValueGuard.IsUndefined(left.items) && index_9.ValueGuard.IsUndefined(right.items)) ? ExtendsResult.False :
|
|
506
506
|
(index_9.ValueGuard.IsUndefined(left.items) && !index_9.ValueGuard.IsUndefined(right.items)) ? ExtendsResult.True :
|
|
507
507
|
left.items.every((schema, index) => Visit(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True :
|
|
@@ -513,9 +513,9 @@ function TTuple(left, right) {
|
|
|
513
513
|
// prettier-ignore
|
|
514
514
|
function TUint8Array(left, right) {
|
|
515
515
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
516
|
-
index_9.TypeGuard.
|
|
517
|
-
index_9.TypeGuard.
|
|
518
|
-
index_9.TypeGuard.
|
|
516
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
517
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
518
|
+
index_9.TypeGuard.IsUint8Array(right) ? ExtendsResult.True :
|
|
519
519
|
ExtendsResult.False);
|
|
520
520
|
}
|
|
521
521
|
// ------------------------------------------------------------------
|
|
@@ -524,10 +524,10 @@ function TUint8Array(left, right) {
|
|
|
524
524
|
// prettier-ignore
|
|
525
525
|
function TUndefined(left, right) {
|
|
526
526
|
return (IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
527
|
-
index_9.TypeGuard.
|
|
528
|
-
index_9.TypeGuard.
|
|
529
|
-
index_9.TypeGuard.
|
|
530
|
-
index_9.TypeGuard.
|
|
527
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
528
|
+
index_9.TypeGuard.IsRecord(right) ? TRecordRight(left, right) :
|
|
529
|
+
index_9.TypeGuard.IsVoid(right) ? VoidRight(left, right) :
|
|
530
|
+
index_9.TypeGuard.IsUndefined(right) ? ExtendsResult.True :
|
|
531
531
|
ExtendsResult.False);
|
|
532
532
|
}
|
|
533
533
|
// ------------------------------------------------------------------
|
|
@@ -554,18 +554,18 @@ function TUnknownRight(left, right) {
|
|
|
554
554
|
}
|
|
555
555
|
// prettier-ignore
|
|
556
556
|
function TUnknown(left, right) {
|
|
557
|
-
return (index_9.TypeGuard.
|
|
558
|
-
index_9.TypeGuard.
|
|
559
|
-
index_9.TypeGuard.
|
|
560
|
-
index_9.TypeGuard.
|
|
561
|
-
index_9.TypeGuard.
|
|
562
|
-
index_9.TypeGuard.
|
|
563
|
-
index_9.TypeGuard.
|
|
564
|
-
index_9.TypeGuard.
|
|
565
|
-
index_9.TypeGuard.
|
|
566
|
-
index_9.TypeGuard.
|
|
567
|
-
index_9.TypeGuard.
|
|
568
|
-
index_9.TypeGuard.
|
|
557
|
+
return (index_9.TypeGuard.IsNever(right) ? TNeverRight(left, right) :
|
|
558
|
+
index_9.TypeGuard.IsIntersect(right) ? TIntersectRight(left, right) :
|
|
559
|
+
index_9.TypeGuard.IsUnion(right) ? TUnionRight(left, right) :
|
|
560
|
+
index_9.TypeGuard.IsAny(right) ? TAnyRight(left, right) :
|
|
561
|
+
index_9.TypeGuard.IsString(right) ? TStringRight(left, right) :
|
|
562
|
+
index_9.TypeGuard.IsNumber(right) ? TNumberRight(left, right) :
|
|
563
|
+
index_9.TypeGuard.IsInteger(right) ? TIntegerRight(left, right) :
|
|
564
|
+
index_9.TypeGuard.IsBoolean(right) ? TBooleanRight(left, right) :
|
|
565
|
+
index_9.TypeGuard.IsArray(right) ? TArrayRight(left, right) :
|
|
566
|
+
index_9.TypeGuard.IsTuple(right) ? TTupleRight(left, right) :
|
|
567
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
568
|
+
index_9.TypeGuard.IsUnknown(right) ? ExtendsResult.True :
|
|
569
569
|
ExtendsResult.False);
|
|
570
570
|
}
|
|
571
571
|
// ------------------------------------------------------------------
|
|
@@ -573,53 +573,53 @@ function TUnknown(left, right) {
|
|
|
573
573
|
// ------------------------------------------------------------------
|
|
574
574
|
// prettier-ignore
|
|
575
575
|
function VoidRight(left, right) {
|
|
576
|
-
return (index_9.TypeGuard.
|
|
577
|
-
index_9.TypeGuard.
|
|
576
|
+
return (index_9.TypeGuard.IsUndefined(left) ? ExtendsResult.True :
|
|
577
|
+
index_9.TypeGuard.IsUndefined(left) ? ExtendsResult.True :
|
|
578
578
|
ExtendsResult.False);
|
|
579
579
|
}
|
|
580
580
|
// prettier-ignore
|
|
581
581
|
function TVoid(left, right) {
|
|
582
|
-
return (index_9.TypeGuard.
|
|
583
|
-
index_9.TypeGuard.
|
|
584
|
-
index_9.TypeGuard.
|
|
585
|
-
index_9.TypeGuard.
|
|
586
|
-
index_9.TypeGuard.
|
|
587
|
-
index_9.TypeGuard.
|
|
582
|
+
return (index_9.TypeGuard.IsIntersect(right) ? TIntersectRight(left, right) :
|
|
583
|
+
index_9.TypeGuard.IsUnion(right) ? TUnionRight(left, right) :
|
|
584
|
+
index_9.TypeGuard.IsUnknown(right) ? TUnknownRight(left, right) :
|
|
585
|
+
index_9.TypeGuard.IsAny(right) ? TAnyRight(left, right) :
|
|
586
|
+
index_9.TypeGuard.IsObject(right) ? TObjectRight(left, right) :
|
|
587
|
+
index_9.TypeGuard.IsVoid(right) ? ExtendsResult.True :
|
|
588
588
|
ExtendsResult.False);
|
|
589
589
|
}
|
|
590
590
|
// prettier-ignore
|
|
591
591
|
function Visit(left, right) {
|
|
592
592
|
return (
|
|
593
593
|
// resolvable
|
|
594
|
-
(index_9.TypeGuard.
|
|
595
|
-
(index_9.TypeGuard.
|
|
594
|
+
(index_9.TypeGuard.IsTemplateLiteral(left) || index_9.TypeGuard.IsTemplateLiteral(right)) ? TTemplateLiteral(left, right) :
|
|
595
|
+
(index_9.TypeGuard.IsNot(left) || index_9.TypeGuard.IsNot(right)) ? TNot(left, right) :
|
|
596
596
|
// standard
|
|
597
|
-
index_9.TypeGuard.
|
|
598
|
-
index_9.TypeGuard.
|
|
599
|
-
index_9.TypeGuard.
|
|
600
|
-
index_9.TypeGuard.
|
|
601
|
-
index_9.TypeGuard.
|
|
602
|
-
index_9.TypeGuard.
|
|
603
|
-
index_9.TypeGuard.
|
|
604
|
-
index_9.TypeGuard.
|
|
605
|
-
index_9.TypeGuard.
|
|
606
|
-
index_9.TypeGuard.
|
|
607
|
-
index_9.TypeGuard.
|
|
608
|
-
index_9.TypeGuard.
|
|
609
|
-
index_9.TypeGuard.
|
|
610
|
-
index_9.TypeGuard.
|
|
611
|
-
index_9.TypeGuard.
|
|
612
|
-
index_9.TypeGuard.
|
|
613
|
-
index_9.TypeGuard.
|
|
614
|
-
index_9.TypeGuard.
|
|
615
|
-
index_9.TypeGuard.
|
|
616
|
-
index_9.TypeGuard.
|
|
617
|
-
index_9.TypeGuard.
|
|
618
|
-
index_9.TypeGuard.
|
|
619
|
-
index_9.TypeGuard.
|
|
620
|
-
index_9.TypeGuard.
|
|
621
|
-
index_9.TypeGuard.
|
|
622
|
-
index_9.TypeGuard.
|
|
597
|
+
index_9.TypeGuard.IsAny(left) ? TAny(left, right) :
|
|
598
|
+
index_9.TypeGuard.IsArray(left) ? TArray(left, right) :
|
|
599
|
+
index_9.TypeGuard.IsBigInt(left) ? TBigInt(left, right) :
|
|
600
|
+
index_9.TypeGuard.IsBoolean(left) ? TBoolean(left, right) :
|
|
601
|
+
index_9.TypeGuard.IsAsyncIterator(left) ? TAsyncIterator(left, right) :
|
|
602
|
+
index_9.TypeGuard.IsConstructor(left) ? TConstructor(left, right) :
|
|
603
|
+
index_9.TypeGuard.IsDate(left) ? TDate(left, right) :
|
|
604
|
+
index_9.TypeGuard.IsFunction(left) ? TFunction(left, right) :
|
|
605
|
+
index_9.TypeGuard.IsInteger(left) ? TInteger(left, right) :
|
|
606
|
+
index_9.TypeGuard.IsIntersect(left) ? TIntersect(left, right) :
|
|
607
|
+
index_9.TypeGuard.IsIterator(left) ? TIterator(left, right) :
|
|
608
|
+
index_9.TypeGuard.IsLiteral(left) ? TLiteral(left, right) :
|
|
609
|
+
index_9.TypeGuard.IsNever(left) ? TNever(left, right) :
|
|
610
|
+
index_9.TypeGuard.IsNull(left) ? TNull(left, right) :
|
|
611
|
+
index_9.TypeGuard.IsNumber(left) ? TNumber(left, right) :
|
|
612
|
+
index_9.TypeGuard.IsObject(left) ? TObject(left, right) :
|
|
613
|
+
index_9.TypeGuard.IsRecord(left) ? TRecord(left, right) :
|
|
614
|
+
index_9.TypeGuard.IsString(left) ? TString(left, right) :
|
|
615
|
+
index_9.TypeGuard.IsSymbol(left) ? TSymbol(left, right) :
|
|
616
|
+
index_9.TypeGuard.IsTuple(left) ? TTuple(left, right) :
|
|
617
|
+
index_9.TypeGuard.IsPromise(left) ? TPromise(left, right) :
|
|
618
|
+
index_9.TypeGuard.IsUint8Array(left) ? TUint8Array(left, right) :
|
|
619
|
+
index_9.TypeGuard.IsUndefined(left) ? TUndefined(left, right) :
|
|
620
|
+
index_9.TypeGuard.IsUnion(left) ? TUnion(left, right) :
|
|
621
|
+
index_9.TypeGuard.IsUnknown(left) ? TUnknown(left, right) :
|
|
622
|
+
index_9.TypeGuard.IsVoid(left) ? TVoid(left, right) :
|
|
623
623
|
Throw(`Unknown left type operand '${left[index_8.Kind]}'`));
|
|
624
624
|
}
|
|
625
625
|
function ExtendsCheck(left, right) {
|
|
@@ -22,8 +22,8 @@ function ExtendsResolve(left, right, trueType, falseType) {
|
|
|
22
22
|
/** `[Json]` Creates a Conditional type */
|
|
23
23
|
function Extends(L, R, T, F, options = {}) {
|
|
24
24
|
// prettier-ignore
|
|
25
|
-
return ((0, type_2.
|
|
26
|
-
(0, type_2.
|
|
25
|
+
return ((0, type_2.IsMappedResult)(L) ? (0, extends_from_mapped_result_1.ExtendsFromMappedResult)(L, R, T, F, options) :
|
|
26
|
+
(0, type_2.IsMappedKey)(L) ? (0, type_1.CloneType)((0, extends_from_mapped_key_1.ExtendsFromMappedKey)(L, R, T, F, options)) :
|
|
27
27
|
(0, type_1.CloneType)(ExtendsResolve(L, R, T, F), options));
|
|
28
28
|
}
|
|
29
29
|
exports.Extends = Extends;
|