Decompose monolithic readme into docs/ directory structure
This commit is contained in:
16
docs/types/generics.md
Normal file
16
docs/types/generics.md
Normal file
@@ -0,0 +1,16 @@
|
||||
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | **Types** | [Values](../values/) | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
|
||||
|
||||
# Generic Types
|
||||
|
||||
Generic types can be created with generic functions.
|
||||
|
||||
```typescript
|
||||
const Nullable = <T extends TSchema>(T: T) => {
|
||||
// type Nullable<T> = T | null
|
||||
return Type.Union([T, Type.Null()]);
|
||||
};
|
||||
|
||||
const T = Nullable(Type.String()); // type T = Nullable<string>
|
||||
```
|
||||
|
||||
Back to [Home](../../readme.md)
|
||||
Reference in New Issue
Block a user