@sinclair/typebox 0.26.7 → 0.26.8
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/package.json +1 -1
- package/readme.md +3 -3
- package/typebox.d.ts +2 -0
- package/typebox.js +8 -0
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -444,12 +444,12 @@ The following table lists the Standard TypeBox types. These types are fully comp
|
|
|
444
444
|
│ │ │ } │
|
|
445
445
|
│ │ │ │
|
|
446
446
|
├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤
|
|
447
|
-
│ const
|
|
448
|
-
│ x: Type.Number(), │ x: number, │ $ref: '
|
|
447
|
+
│ const T = Type.Object({ │ type T = { │ const R = { │
|
|
448
|
+
│ x: Type.Number(), │ x: number, │ $ref: 'T' │
|
|
449
449
|
│ y: Type.Number() │ y: number │ } │
|
|
450
450
|
│ }, { $id: 'T' }) | } │ │
|
|
451
451
|
│ │ │ │
|
|
452
|
-
│ const
|
|
452
|
+
│ const R = Type.Ref(T) │ type R = T │ │
|
|
453
453
|
│ │ │ │
|
|
454
454
|
│ │ │ │
|
|
455
455
|
│ │ │ │
|
package/typebox.d.ts
CHANGED
|
@@ -477,6 +477,8 @@ export declare namespace TypeGuard {
|
|
|
477
477
|
function TUint8Array(schema: unknown): schema is TUint8Array;
|
|
478
478
|
/** Returns true if the given schema is TUnknown */
|
|
479
479
|
function TUnknown(schema: unknown): schema is TUnknown;
|
|
480
|
+
/** Returns true if the given schema is a raw TUnsafe */
|
|
481
|
+
function TUnsafe(schema: unknown): schema is TUnsafe<unknown>;
|
|
480
482
|
/** Returns true if the given schema is TVoid */
|
|
481
483
|
function TVoid(schema: unknown): schema is TVoid;
|
|
482
484
|
/** Returns true if this schema has the ReadonlyOptional modifier */
|
package/typebox.js
CHANGED
|
@@ -513,6 +513,13 @@ var TypeGuard;
|
|
|
513
513
|
IsOptionalString(schema.$id));
|
|
514
514
|
}
|
|
515
515
|
TypeGuard.TUnknown = TUnknown;
|
|
516
|
+
/** Returns true if the given schema is a raw TUnsafe */
|
|
517
|
+
function TUnsafe(schema) {
|
|
518
|
+
// prettier-ignore
|
|
519
|
+
return (TKind(schema) &&
|
|
520
|
+
schema[exports.Kind] === 'Unsafe');
|
|
521
|
+
}
|
|
522
|
+
TypeGuard.TUnsafe = TUnsafe;
|
|
516
523
|
/** Returns true if the given schema is TVoid */
|
|
517
524
|
function TVoid(schema) {
|
|
518
525
|
// prettier-ignore
|
|
@@ -567,6 +574,7 @@ var TypeGuard;
|
|
|
567
574
|
TUnion(schema) ||
|
|
568
575
|
TUint8Array(schema) ||
|
|
569
576
|
TUnknown(schema) ||
|
|
577
|
+
TUnsafe(schema) ||
|
|
570
578
|
TVoid(schema) ||
|
|
571
579
|
(TKind(schema) && TypeRegistry.Has(schema[exports.Kind]))));
|
|
572
580
|
}
|