AA

arktypeio/arktype

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7892 stars 质量 73 趋势 86MIT

TypeScript是最小,最快的验证器. 赶紧走.

概览

Docs & nbsp;\\ nbsp; 基准 & nbsp;\ nbsp; 预编 & nbsp;\ nbsp; 从 Zod & nbsp;\\ nbsp; 游戏场 & nbsp;\\ nbsp; 迪斯科尔 在TypeScript自己的语法中写入定义——推断出1:1,并在运行时验证. 与任何需要标准Schema(tRPC,Hono, React Hook Form, Drizzle, AI SDK, MCP SDK等)的工作. 请参看Zod, Valibot, TypeBox, Yup, Joi, Effect Schema, 和JSON Schema的迁移指南. - 安装、编辑器设置和你的第一种类型 - 使用@ark/aot在构建时编译类型 - 速度、启动和捆绑大小,并附有方法和再运行命令 - 从Zod、Valibot、TypeBox、Yup、Joi、Effect Schema和JSON Schema - 从 arktype.io/llms.txt - 发布注释和升级 。 arktype 船用方舟二进制(init, 迁移, 技能.

概述(AI 翻译)

文档 & nbsp;\\ nbsp; ) 基准 & nbsp;\\ nbsp; ) 预编译 & nbsp;\\ nbsp; ) 从Zod迁移 & nbsp;\\ nbsp; ) 游戏场 & nbsp;\\ nbsp; ) 调色板

快开始

在TypeScript自己的语法中写入定义——推断出1:1,并在运行时验证. 与任何需要标准Schema(tRPC,Hono, React Hook Form, Drizzle, AI SDK, MCP SDK等)的工作.

□ 用一分速率移动

  1. 添加 ArkType 代理技能:

  2. 询问您的编码代理:

请参看Zod, Valibot, TypeBox, Yup, Joi, Effect Schema, 和JSON Schema的迁移指南.

□ 医生

  • ** 启动** — 安装、 编辑器设置, 以及您的第一种类型
  • ** 编制**——在构建时编译类型@ark/aot
  • ** Benchmarks ** — 速度、启动和捆绑大小,并附有方法和再运行命令
  • ** 迁移指南**——来自Zod、Valibot、TypeBox、Yep、Joi、Effect Schema和JSON Schema
  • ** 特工** – – 在arktype.io/llms.txt的技能和Markdown文件
  • 3.0中的新内容 — 从2.x发布注释并升级.

□ CLI 语录

[[T1]号船舶[[T2] 二进制([[T3]、[T4]、[T5]和[T6]]/[[T7]/declare至[T9]]]).

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Docs  ·  Benchmarks  ·  Precompile  ·  Migrate from Zod  ·  Playground  ·  Discord

Quick start

npm install arktype

Write definitions in TypeScript’s own syntax — inferred 1:1 and validated at runtime. Works with anything that takes Standard Schema (tRPC, Hono, React Hook Form, Drizzle, AI SDK, MCP SDK, and more).

import { type } from "arktype"

const User = type({
	name: "string > 0",
	email: "string.email",
	"age?": "number.integer >= 0"
})

// { name: string; email: string; age?: number }
type User = typeof User.infer

const out = User({ name: "Ada", email: "ada@", age: -1 })

if (out instanceof type.errors) {
	// email must be an email address
	// age must be non-negative
	console.error(out.summary)
} else {
	// out is a User
	console.log(out.name)
}

Migrate with one prompt

  1. Add the ArkType agent skill:

    npx skills add arktypeio/arktype
    
  2. Ask your coding agent:

    Migrate this project from Zod to ArkType.
    

See the migration guide for Zod, Valibot, TypeBox, Yup, Joi, Effect Schema, and JSON Schema.

Docs

CLI

arktype ships the ark binary (init, migrate, skill, and check / emit / declare via @ark/aot). Inside an installed project, run pnpm exec ark (or npx arktype everywhere — ark on npm is an unrelated package):

npx arktype init     # create ark.json and install the bundled skill
npx arktype migrate  # install the skill and print a migration prompt
npx arktype check    # run @ark/aot --check

Contributions

在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add arktypeio/arktype
新手?先看 mcpskill.org 教程 →