Socket
Socket
Sign inDemoInstall

@sinclair/typebox

Package Overview
Dependencies
Maintainers
1
Versions
326
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox - npm Package Compare versions

Comparing version 0.24.5 to 0.24.6

guard/guard.d.ts

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc