@sinclair/typebox 0.32.0-dev-9 → 0.32.0-dev-10
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.
|
@@ -2,7 +2,7 @@ import { IsArray, IsNumber, IsBigInt, IsUint8Array, IsDate, IsIterator, IsObject
|
|
|
2
2
|
import { Any } from '../any/index.mjs';
|
|
3
3
|
import { BigInt } from '../bigint/index.mjs';
|
|
4
4
|
import { Date } from '../date/index.mjs';
|
|
5
|
-
import { Function } from '../function/index.mjs';
|
|
5
|
+
import { Function as FunctionType } from '../function/index.mjs';
|
|
6
6
|
import { Literal } from '../literal/index.mjs';
|
|
7
7
|
import { Null } from '../null/index.mjs';
|
|
8
8
|
import { Object } from '../object/index.mjs';
|
|
@@ -34,7 +34,7 @@ function FromValue(value, root) {
|
|
|
34
34
|
IsUint8Array(value) ? Uint8Array() :
|
|
35
35
|
IsDate(value) ? Date() :
|
|
36
36
|
IsObject(value) ? ConditionalReadonly(Object(FromProperties(value)), root) :
|
|
37
|
-
IsFunction(value) ? ConditionalReadonly(
|
|
37
|
+
IsFunction(value) ? ConditionalReadonly(FunctionType([], Unknown()), root) :
|
|
38
38
|
IsUndefined(value) ? Undefined() :
|
|
39
39
|
IsNull(value) ? Null() :
|
|
40
40
|
IsSymbol(value) ? Symbol() :
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Any } from '../any/index.mjs';
|
|
2
|
-
import { Function } from '../function/index.mjs';
|
|
2
|
+
import { Function as FunctionType } from '../function/index.mjs';
|
|
3
3
|
import { Number } from '../number/index.mjs';
|
|
4
4
|
import { String } from '../string/index.mjs';
|
|
5
5
|
import { Unknown } from '../unknown/index.mjs';
|
|
@@ -222,7 +222,7 @@ function IsObjectArrayLike(schema) {
|
|
|
222
222
|
return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'length' in schema.properties && IntoBooleanResult(Visit(schema.properties['length'], length)) === ExtendsResult.True);
|
|
223
223
|
}
|
|
224
224
|
function IsObjectPromiseLike(schema) {
|
|
225
|
-
const then =
|
|
225
|
+
const then = FunctionType([Any()], Any());
|
|
226
226
|
return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'then' in schema.properties && IntoBooleanResult(Visit(schema.properties['then'], then)) === ExtendsResult.True);
|
|
227
227
|
}
|
|
228
228
|
function Property(left, right) {
|
|
@@ -5,7 +5,7 @@ import { BigInt } from '../bigint/index.mjs';
|
|
|
5
5
|
import { Constructor } from '../constructor/index.mjs';
|
|
6
6
|
import { ConstructorParameters } from '../constructor-parameters/index.mjs';
|
|
7
7
|
import { Date } from '../date/index.mjs';
|
|
8
|
-
import { Function } from '../function/index.mjs';
|
|
8
|
+
import { Function as FunctionType } from '../function/index.mjs';
|
|
9
9
|
import { InstanceType } from '../instance-type/index.mjs';
|
|
10
10
|
import { Iterator } from '../iterator/index.mjs';
|
|
11
11
|
import { Parameters } from '../parameters/index.mjs';
|
|
@@ -36,7 +36,7 @@ export class JavaScriptTypeBuilder extends JsonTypeBuilder {
|
|
|
36
36
|
return Date(options);
|
|
37
37
|
}
|
|
38
38
|
Function(parameters, returns, options) {
|
|
39
|
-
return
|
|
39
|
+
return FunctionType(parameters, returns, options);
|
|
40
40
|
}
|
|
41
41
|
InstanceType(schema, options = {}) {
|
|
42
42
|
return InstanceType(schema, options);
|