@sinclair/typebox
Advanced tools
Comparing version 0.24.5 to 0.24.6
{ | ||
"name": "@sinclair/typebox", | ||
"version": "0.24.5", | ||
"version": "0.24.6", | ||
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -65,2 +65,3 @@ <div align='center'> | ||
- [Values](#Values) | ||
- [Guards](#Guards) | ||
- [Strict](#Strict) | ||
@@ -439,3 +440,3 @@ - [Validation](#Validation) | ||
│ const T = Type.Uint8Array() │ type T = Uint8Array │ const T = { │ | ||
│ │ │ type: 'Uint8Array', │ | ||
│ │ │ type: 'object', │ | ||
│ │ │ specialized: 'Uint8Array' │ | ||
@@ -605,2 +606,3 @@ │ │ │ } │ | ||
``` | ||
<a name="Values"></a> | ||
@@ -629,2 +631,25 @@ | ||
<a name="Guards"></a> | ||
### Guards | ||
In some scenarios it may be helpful to test if an object is a valid TypeBox type. You can use the TypeGuard module to check an object conforms to a valid TypeBox schema representation. Consider the following. | ||
```typescript | ||
import { TypeGuard } from '@sinclair/typebox/guard' | ||
import { Type } from '@sinclair/typebox' | ||
const T: any = Type.String() // T is any | ||
const { type } = T // unsafe: type is any | ||
if(TypeGuard.TString(T)) { | ||
const { type } = T // safe: type is 'string' | ||
} | ||
``` | ||
<a name="Strict"></a> | ||
@@ -631,0 +656,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193388
33
3044
812