@sinclair/typebox 0.26.0 → 0.26.1
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/compiler/compiler.js +0 -2
- package/package.json +1 -1
- package/typebox.d.ts +2 -2
- package/typebox.js +2 -2
- package/value/check.js +2 -2
package/compiler/compiler.js
CHANGED
|
@@ -298,8 +298,6 @@ var TypeCompiler;
|
|
|
298
298
|
}
|
|
299
299
|
function* Object(schema, references, value) {
|
|
300
300
|
yield IsObjectCheck(value);
|
|
301
|
-
if (!index_2.TypeSystem.AllowArrayObjects)
|
|
302
|
-
yield `!Array.isArray(${value})`;
|
|
303
301
|
if (IsNumber(schema.minProperties))
|
|
304
302
|
yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`;
|
|
305
303
|
if (IsNumber(schema.maxProperties))
|
package/package.json
CHANGED
package/typebox.d.ts
CHANGED
|
@@ -503,7 +503,7 @@ export declare namespace TypeExtends {
|
|
|
503
503
|
}
|
|
504
504
|
/** Specialized Clone for Types */
|
|
505
505
|
export declare namespace TypeClone {
|
|
506
|
-
/** Clones a type.
|
|
506
|
+
/** Clones a type. */
|
|
507
507
|
function Clone<T extends TSchema>(schema: T, options: SchemaOptions): T;
|
|
508
508
|
}
|
|
509
509
|
export declare namespace ObjectMap {
|
|
@@ -539,7 +539,7 @@ export declare class StandardTypeBuilder extends TypeBuilder {
|
|
|
539
539
|
Extends<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema>(left: L, right: R, trueType: T, falseType: U, options?: SchemaOptions): TExtends<L, R, T, U>;
|
|
540
540
|
/** `[Standard]` Excludes from the left type any type that is not assignable to the right */
|
|
541
541
|
Exclude<L extends TSchema, R extends TSchema>(left: L, right: R, options?: SchemaOptions): TExclude<L, R>;
|
|
542
|
-
/** `[Standard]` Extracts from
|
|
542
|
+
/** `[Standard]` Extracts from the left type any type that is assignable to the right */
|
|
543
543
|
Extract<L extends TSchema, R extends TSchema>(left: L, right: R, options?: SchemaOptions): TExtract<L, R>;
|
|
544
544
|
/** `[Standard]` Creates an Integer type */
|
|
545
545
|
Integer(options?: NumericOptions<number>): TInteger;
|
package/typebox.js
CHANGED
|
@@ -1347,7 +1347,7 @@ var TypeClone;
|
|
|
1347
1347
|
return Object(value);
|
|
1348
1348
|
return value;
|
|
1349
1349
|
}
|
|
1350
|
-
/** Clones a type.
|
|
1350
|
+
/** Clones a type. */
|
|
1351
1351
|
function Clone(schema, options) {
|
|
1352
1352
|
return { ...Visit(schema), ...options };
|
|
1353
1353
|
}
|
|
@@ -1503,7 +1503,7 @@ class StandardTypeBuilder extends TypeBuilder {
|
|
|
1503
1503
|
return (TypeExtends.Extends(left, right) !== TypeExtendsResult.False ? this.Never(options) : TypeClone.Clone(left, options));
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
|
-
/** `[Standard]` Extracts from
|
|
1506
|
+
/** `[Standard]` Extracts from the left type any type that is assignable to the right */
|
|
1507
1507
|
Extract(left, right, options = {}) {
|
|
1508
1508
|
if (TypeGuard.TUnion(left)) {
|
|
1509
1509
|
const narrowed = left.anyOf.filter((inner) => TypeExtends.Extends(inner, right) !== TypeExtendsResult.False);
|
package/value/check.js
CHANGED
|
@@ -237,10 +237,10 @@ var ValueCheck;
|
|
|
237
237
|
if (!IsObject(value)) {
|
|
238
238
|
return false;
|
|
239
239
|
}
|
|
240
|
-
if (
|
|
240
|
+
if (IsDefined(schema.minProperties) && !(globalThis.Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
241
241
|
return false;
|
|
242
242
|
}
|
|
243
|
-
if (
|
|
243
|
+
if (IsDefined(schema.maxProperties) && !(globalThis.Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
244
244
|
return false;
|
|
245
245
|
}
|
|
246
246
|
const knownKeys = globalThis.Object.getOwnPropertyNames(schema.properties);
|