Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

type-display-attention类型显示注意

Agent Skill

type-display-attention 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

198

周安装

8

GitHub Stars

2

下载量

62
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:type-display-attention(类型显示注意)
来源仓库:https://github.com/marius-townhouse/effective-typescript-skills
仓库路径:skills/type-display-attention
安装命令:
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill type-display-attention
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill type-display-attention

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 可围绕代码变更、仓库状态或协作事项进行信息整理。
  • 通过 npx skills add 命令从 GitHub 仓库安装,需确认访问权限。
  • 使用前建议核实是否会触发命令执行或文件读写操作。
  • type-display-attention 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Pay Attention to How Types Display

Overview

The types you write are not just for the compiler - they're also for developers reading code in their IDE. Complex types can display as unwieldy expansions that obscure meaning and hurt developer experience. Understanding how to control type display helps you create types that are both correct and readable.

Type display matters for debugging, API usability, and overall developer productivity. A type that works correctly but displays poorly creates friction.

When to Use This Skill

  • Complex types display poorly in hover tooltips
  • Users see expanded instead of named types
  • Debugging confusing type errors
  • Building public APIs with generic types
  • Types become deeply nested or recursive

The Iron Rule

Control how types display using type aliases and identity mapped types. Ensure your types are readable in IDE tooltips and error messages.

Detection

Watch for these display issues:

// UGLY DISPLAY - Users see this expansion:
// { [K in keyof T as ToCamel<K & string>]: T[K] }
// Instead of a clean name

// CONFUSING ERROR - Type displays as:
// { a: { b: { c: { d: string } } } }
// Instead of: DeepNested<string>

The Identity Mapped Type Trick

Force TypeScript to preserve a type alias:

// Without trick - displays as expansion
type ObjectToCamel<T> = {
  [K in keyof T as ToCamel<K & string>]: T[K]
};

const result = objectToCamel({ foo_bar: 1 });
// Hover shows: { [K in keyof T as ToCamel<...

// With identity mapped type - displays as name
type ObjectToCamel<T> = {
  [K in keyof T as ToCamel<K & string>]: T[K]
} extends infer O
  ? { [K in keyof O]: O[K] }
  : never;

const result = objectToCamel({ foo_bar: 1 });
// Hover shows: ObjectToCamel<{ foo_bar: number }>

Creating Clean Type Aliases

// BAD: Complex inline type
function processData(
  input: { [K in keyof User as `set${Capitalize<K & string>}`]: User[K] }
): void;

// GOOD: Named type alias
type SetterMethods<T> = {
  [K in keyof T as `set${Capitalize<K & string>}`]: T[K]
};

function processData(input: SetterMethods<User>): void;
// Displays as: SetterMethods<User>

Simplifying Complex Return Types

// Complex generic return type
type QueryResult<T> = T extends { data: infer D }
  ? D extends Array<infer Item>
    ? PaginatedResult<Item>
    : SingleResult<D>
  : ErrorResult;

// Simplify display with intermediate type
type QueryResult<T> = T extends { data: infer D }
  ? QueryResultHelper<D>
  : ErrorResult;

type QueryResultHelper<D> = D extends Array<infer Item>
  ? PaginatedResult<Item>
  : SingleResult<D>;

Hiding Implementation Details

// Internal complex type
type InternalTransform<T> = /* complex 10-line type */;

// Public clean type
type PublicType<T> = InternalTransform<T> extends infer R
  ? { [K in keyof R]: R[K] }
  : never;

// Users see: PublicType<T>
// Not the messy InternalTransform expansion

Preserving Type Names in Unions

// Each branch keeps its name
type Result<T> =
  | { type: 'success'; data: T }
  | { type: 'error'; error: Error }
  | { type: 'loading' };

// Displays cleanly as:
// Result<User> =
//   | { type: 'success'; data: User }
//   | { type: 'error'; error: Error }
//   | { type: 'loading' }

Testing Type Display

Check how your types appear in practice:

// Create test cases to see how types display
type TestCase1 = YourComplexType<{ a: string }>;
// Hover over TestCase1 to see display

type TestCase2 = YourComplexType<{ nested: { deep: number } }>;
// Check nested case

// Check error messages
const x: TestCase1 = {} as any;
// Trigger an error to see how type appears in message

IDE-Specific Considerations

Different IDEs display types differently:

// VS Code: Hover to see type
type Example = /* your type */;

// Check in:
// - Hover tooltips
// - IntelliSense autocomplete
// - Error message panels
// - Quick fix suggestions

Pressure Resistance Protocol

When types display poorly:

  1. Check hover tooltips: See what users actually see
  2. Introduce aliases: Break complex types into named pieces
  3. Use identity mapped type: Force preservation of type names
  4. Test error messages: Ensure errors reference clean type names
  5. Consider simplification: Maybe the type is too complex

Red Flags

SymptomProblemSolution
Type shows as expansionNot preserving aliasIdentity mapped type
Deeply nested displayToo many levelsIntermediate type aliases
Generic noiseToo many type paramsSimplify or use defaults
Unreadable in errorsComplex conditionalNamed result types

Common Rationalizations

"Users can read the expansion"

Reality: Complex expansions are hard to read. Clean names convey intent immediately.

"It's just for internal use"

Reality: Internal types are read by colleagues (and future you). Clean display helps everyone.

"The type is inherently complex"

Reality: You can hide complexity behind clean interfaces. Users don't need to see all the machinery.

Quick Reference

TechniqueSyntaxUse When
Type aliastype Name =...Any complex type
Identity mappedextends infer O? {[K in keyof O]: O[K]}: neverForce name preservation
Intermediate typesBreak into stepsMulti-step transformations
Union branchesNamed object typesDiscriminated unions

The Bottom Line

Types are user interface. Control how they display using aliases and identity mapped types. Readable types in hover tooltips and error messages improve developer experience.

Reference

  • Effective TypeScript, 2nd Edition by Dan Vanderkam
  • Item 56: Pay Attention to How Types Display

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.93%
按下载量换算24

Claude

29.28%
按下载量换算18

Cursor

19.27%
按下载量换算12

Gemini CLI

9.42%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills