Decompose monolithic readme into docs/ directory structure

This commit is contained in:
2026-04-23 13:57:56 +00:00
parent 560bb00433
commit f8b2cdd5a4
47 changed files with 1936 additions and 1829 deletions

35
docs/types/modules.md Normal file
View File

@@ -0,0 +1,35 @@
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | **Types** | [Values](../values/) | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
# Module Types
Module types are containers for a set of referential types. Modules act as namespaces, enabling types to reference one another via string identifiers. Modules support both singular and mutually recursive references, as well as deferred dereferencing for computed types such as Partial. Types imported from a module are expressed using the Json Schema `$defs` keyword.
```typescript
const Module = Type.Module({
PartialUser: Type.Partial(Type.Ref("User")), // TComputed<'Partial', [TRef<'User'>]>
User: Type.Object({
// TObject<{
id: Type.String(), // user: TString,
name: Type.String(), // name: TString,
email: Type.String(), // email: TString
}), // }>
});
const User = Module.Import("User"); // const User: TImport<{...}, 'User'>
type User = Static<typeof User>; // type User = {
// id: string,
// name: string,
// email: string
// }
const PartialUser = Module.Import("PartialUser"); // const PartialUser: TImport<{...}, 'PartialUser'>
type PartialUser = Static<typeof PartialUser>; // type PartialUser = {
// id?: string,
// name?: string,
// email?: string
// }
```
Back to [Home](../../readme.md)