Decompose monolithic readme into docs/ directory structure
This commit is contained in:
17
docs/types/typeguard.md
Normal file
17
docs/types/typeguard.md
Normal file
@@ -0,0 +1,17 @@
|
||||
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | **Types** | [Values](../values/) | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
|
||||
|
||||
# TypeGuard
|
||||
|
||||
TypeBox can check its own types with the TypeGuard module. This module is written for type introspection and provides structural tests for every built-in TypeBox type. Functions of this module return `is` guards which can be used with control flow assertions to obtain schema inference for unknown values. The following guards that the value `T` is TString.
|
||||
|
||||
```typescript
|
||||
import { TypeGuard, Kind } from "@alkdev/typebox";
|
||||
|
||||
const T = { [Kind]: "String", type: "string" };
|
||||
|
||||
if (TypeGuard.IsString(T)) {
|
||||
// T is TString
|
||||
}
|
||||
```
|
||||
|
||||
Back to [Home](../../readme.md)
|
||||
Reference in New Issue
Block a user