首页/ AI 技能 / @skilllib/skill-2117939930272414980
Skill站外收录 @skilllib/skill-2117939930272414980

typescript

规范 TypeScript 代码的类型定义与模块导入方式,禁止使用 any 类型和类型断言,要求函数参数采用内联接口而非独立声明,且所有导入必须为直接命名导入,禁用 index barrel 文件。

0.0 (0) 13 次安装 原作者 编程导航
收录于 2026-01-22
测试与安全 AI 技能

Skills.MD

## Typing Guidelines - Avoid `any` at all cost. The types should work or they indicate a problem. - Never use `as "any"` or `as unknown as` to solve/avoid type errors. The types should work or they indicate a problem. - Avoid using `as` to cast to a specific type. The types should work or they indicate a problem. ## Exports / Imports - Never create index barrel files (index.ts, index.js) - Always use direct imports with named exports - Always use inline interfaces with function parameters ## Examples ### Good - Inline interface with function: ```typescript export function processData({ id, name, options, }: { id: string; name: string; options: ProcessingOptions; }): ProcessedResult { // implementation } ``` ### Bad - Separated interface: ```typescript interface ProcessDataProps { id: string; name: string; options: ProcessingOptions; } export function processDAta({ id, name, options, }: ProcessDataProps): ProcessResult { // Implementation } ```

评论 0

还没有评论,来抢沙发。