typescript by lobehub/lobehub
npx skills add https://github.com/lobehub/lobehub --skill typescriptany;必要时显式声明类型Record<PropertyKey, unknown> 而非 object 或 anyinterface;对于联合/交叉类型使用 typeas const satisfies XyzInterface 而非普通的 as const@ts-expect-error,其次是 ,最后才是 广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@ts-ignoreas anydeclare module '...')而非 namespace;不要引入基于 namespace 的扩展模式PipelineContext.metadata 这样的包内可扩展模式,在读取或写入这些元数据的处理器/提供者/插件旁边定义元数字段async/await 而非回调或 .then() 链*Sync)import { readFile } from 'fs/promises'Promise.all、Promise.race 进行并发操作本项目使用 simple-import-sort/imports 和 consistent-type-imports(fixStyle: 'separate-type-imports')
分离类型导入:对于仅类型导入,始终使用 import type { ... },而不是 import { type ... } 内联语法
当一个文件已经通过 import type { ... } 从某个包导入了类型,而你需要添加一个值导入时,请将它们保持为两条独立的语句:
import type { ChatTopicBotContext } from '@lobechat/types';
import { RequestTrigger } from '@lobechat/types';
在每个导入语句内部,导入项按名称字母顺序排序
@lobehub/ui、Ant Design 组件,而非原始 HTML 标签antd-style 令牌系统,而非硬编码的颜色for…of 循环而非基于索引的 for 循环packages/utils 中的现有工具函数或已安装的 npm 包Date.now() 赋值给一个常量并复用,以确保一致性import { log } from 'debug'(会输出到控制台)console.error 而非 debug 包.catch() 回调中记录错误——静默的 .catch(() => fallback) 会吞掉失败信息,使调试无法进行每周安装量
831
代码仓库
GitHub 星标数
74.1K
首次出现
2026年1月27日
安全审计
安装于
opencode706
codex701
gemini-cli690
github-copilot667
kimi-cli599
amp595
any; explicitly type when necessaryRecord<PropertyKey, unknown> over object or anyinterface for object shapes (e.g., React props); use type for unions/intersectionsas const satisfies XyzInterface over plain as const@ts-expect-error over @ts-ignore over as anydeclare module '...') over namespace; do not introduce namespace-based extension patternsPipelineContext.metadata, define the metadata fields next to the processor/provider/plugin that reads or writes themasync/await over callbacks or .then() chains*Sync)import { readFile } from 'fs/promises'Promise.all, Promise.race for concurrent operations where safeThis project uses simple-import-sort/imports and consistent-type-imports (fixStyle: 'separate-type-imports')
Separate type imports : always use import type { ... } for type-only imports, NOT import { type ... } inline syntax
When a file already has import type { ... } from a package and you need to add a value import, keep them as two separate statements :
import type { ChatTopicBotContext } from '@lobechat/types';
import { RequestTrigger } from '@lobechat/types';
Within each import statement, specifiers are sorted alphabetically by name
@lobehub/ui, Ant Design components instead of raw HTML tagsantd-style token system instead of hard-coded colorsfor…of loops over index-based for loopspackages/utils or installed npm packagesDate.now() to a constant once and reuse for consistencyimport { log } from 'debug' directly (logs to console)console.error in catch blocks instead of debug package.catch() callbacks — silent .catch(() => fallback) swallows failures and makes debugging impossibleWeekly Installs
831
Repository
GitHub Stars
74.1K
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode706
codex701
gemini-cli690
github-copilot667
kimi-cli599
amp595
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
GSAP动画技能:为JARVIS HUD创建流畅专业动画的完整指南
833 周安装
Gemini Interactions API 指南:统一接口、智能体交互与服务器端状态管理
833 周安装
Apollo MCP 服务器:让AI代理通过GraphQL API交互的完整指南
834 周安装
智能体记忆系统构建指南:分块策略、向量存储与检索优化
835 周安装
Scrapling官方网络爬虫框架 - 自适应解析、绕过Cloudflare、Python爬虫库
836 周安装
抽奖赢家选取器 - 随机选择工具,支持CSV、Excel、Google Sheets,公平透明
838 周安装