Loading...
Loading...
Compare original and translation side by side
arktypearktype| Pattern | Usage |
|---|---|
| Define object schema |
| Primitive type |
| Built-in string validators |
| Built-in string morphs (transforms) |
| Parse JSON string to validated object |
| Inline constraints |
| Union types |
| String literal unions |
| Array types |
| Optional properties |
| Default values |
| Transform output (morphs) |
| Custom validation (like Zod refine) |
| Object property selection |
| Combine object types |
| Named type scopes with cross-references |
| Generic type definitions |
| Error handling (check |
| Global defaults (from |
| Type-safe pattern matching (2.1) |
| Inline undeclared key handling |
| 模式 | 用法 |
|---|---|
| 定义对象Schema |
| 原始类型 |
| 内置字符串验证器 |
| 内置字符串转换(transforms) |
| 将JSON字符串解析为经过验证的对象 |
| 内联约束 |
| 联合类型 |
| 字符串字面量联合类型 |
| 数组类型 |
| 可选属性 |
| 默认值 |
| 转换输出(morphs) |
| 自定义验证(类似Zod的refine) |
| 对象属性选择 |
| 合并对象类型 |
| 支持交叉引用的命名类型作用域 |
| 泛型类型定义 |
| 错误处理(检查 |
| 全局默认配置(来自 |
| 类型安全的模式匹配(2.1版本新增) |
| 内联未声明键的处理方式 |
| Mistake | Fix |
|---|---|
| |
Checking errors with | Use |
| |
Importing from | Import |
Nested | Use |
Raw | Use |
| |
Configuring after importing | Import |
| 错误内容 | 修复方案 |
|---|---|
带括号的 | |
使用 | 使用 |
用 | |
从 | 从 |
在字符串表达式中嵌套 | 使用 |
未处理错误的原生 | 对可能抛出异常的操作使用 |
用 | |
导入 | 先导入 |