[Home](./readme.md) | [Installation](./installation.md) | [Usage](./usage.md) | [Types](./types/) | [Values](./values/) | [Syntax](./syntax/) | [TypeRegistry](./type-registry.md) | [TypeCheck](./type-check.md) # TypeSystem The TypeBox TypeSystem module provides configurations to use either Json Schema or TypeScript type checking semantics. Configurations made to the TypeSystem module are observed by the TypeCompiler, Value and Error modules. ## Policies TypeBox validates using standard Json Schema assertion policies by default. The TypeSystemPolicy module can override some of these to have TypeBox assert values inline with TypeScript static checks. It also provides overrides for certain checking rules related to non-serializable values (such as void) which can be helpful in Json based protocols such as Json Rpc 2.0. The following overrides are available. ```typescript import { TypeSystemPolicy } from "@alkdev/typebox/system"; // Disallow undefined values for optional properties (default is false) // // const A: { x?: number } = { x: undefined } - disallowed when enabled TypeSystemPolicy.ExactOptionalPropertyTypes = true; // Allow arrays to validate as object types (default is false) // // const A: {} = [] - allowed in TS TypeSystemPolicy.AllowArrayObject = true; // Allow numeric values to be NaN or + or - Infinity (default is false) // // const A: number = NaN - allowed in TS TypeSystemPolicy.AllowNaN = true; // Allow void types to check with undefined and null (default is false) // // Used to signal void return on Json-Rpc 2.0 protocol TypeSystemPolicy.AllowNullVoid = true; ``` Back to [Home](../readme.md)