Loading...
Loading...
Compare original and translation side by side
anyunknownanyunknownbun # Runtime + package manager (fast)
vite # Frontend bundling
vitest # Testing
eslint # Linting
prettier # Formattingbun # 运行时 + 包管理器(速度快)
vite # 前端打包工具
vitest # 测试工具
eslint # 代码检查工具
prettier # 代码格式化工具function isUser(value: unknown): value is User {
return typeof value === "object" && value !== null && "id" in value;
}function isUser(value: unknown): value is User {
return typeof value === "object" && value !== null && "id" in value;
}type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };
function processResult<T>(result: Result<T>): T {
if (result.ok) return result.value;
throw result.error;
}type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };
function processResult<T>(result: Result<T>): T {
if (result.ok) return result.value;
throw result.error;
}type UserUpdate = Partial<User>;
type UserSummary = Pick<User, "id" | "name">;
type UserWithoutPassword = Omit<User, "password">;
type ReadonlyUser = Readonly<User>;type UserUpdate = Partial<User>;
type UserSummary = Pick<User, "id" | "name">;
type UserWithoutPassword = Omit<User, "password">;
type ReadonlyUser = Readonly<User>;{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"isolatedModules": true
}
}{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"isolatedModules": true
}
}bun install # Install deps
bun run build # Build
bun test # Test
bun run lint # Lint
bun run format # Formatbun install # 安装依赖
bun run build # 构建项目
bun test # 运行测试
bun run lint # 代码检查
bun run format # 代码格式化import typeverbatimModuleSyntaximport { type Foo } from "mod"as constas Foosatisfies FoosatisfiesasassatisfiesArray<T>.includes(x)xTstrictNullChecks: falseTT | null | undefinedtsconfig.jsonextendscompilerOptions.pathsverbatimModuleSyntaximport typeimport { type Foo } from "mod"as constas Foosatisfies FoosatisfiesassatisfiesasArray<T>.includes(x)xTstrictNullChecks: falseTT | null | undefinedtsconfig.jsonextendscompilerOptions.paths