Install any skill in seconds. Free to start, no credit card required.
Get Started Free →協助設定和維護 TypeScript 專案配置。 使用時機: - 建立/更新 tsconfig.json - 診斷配置問題 - 升級 TypeScript 版本 - 理解 compilerOptions - 配置 monorepo - 整合特定框架 觸發關鍵字: - tsconfig - compilerOptions - TypeScript 升級 - strict mode - type definitions - module resolution - target/lib/types
.claude/skills/bluelovers-typescript-config/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-16 | ✓→✓ | = Same ✓ | 42% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 3% | 0% |
提供 TypeScript 專案配置的實用指導,包含 tsconfig.json 設定、編譯選項解釋、版本升級指南與問題診斷。
Property 'fromEntries' does not exist
原因 (WHY): Object.fromEntries 等新 API 屬於較新的 ECMAScript 標準。如果 tsconfig.json 中的 lib 或 target 配置過舊(例如 ES2015),TypeScript 編譯器就不會載入對應的內建型別聲明,導致編譯失敗。
做法 (WHAT): 提升 lib 版本至包含該 API 的 ECMAScript 標準(如 ES2022 或更新版本)。
json{ "compilerOptions": { "lib": [ "ES2022" ] } }
變更: TypeScript 6 不再自動載入 node_modules/@types 下的所有型別定義。
原因 (WHY):
做法 (WHAT): 必須在 compilerOptions.types 中明確列出專案所依賴的全域型別(如 node、jest 等),否則編譯時會出現 "Cannot find name" 錯誤。
json{ "compilerOptions": { "types": [ "node", "jest" ] } }
變更: 提供 ignoreDeprecations 選項以抑制特定版本的棄用警告。
原因 (WHY): 專案在升級至 TypeScript 6.0 時,可能仍包含已被棄用或將移除的舊版配置項。此選項允許團隊在不被大量編譯警告阻塞的情況下完成升級,爭取時間逐步重構與清理技術債。
做法 (WHAT):
json{ "compilerOptions": { "ignoreDeprecations": "6.0" } }
當遇到編譯問題時,按以下項目進行檢查,以釐清問題根源:
types 和 @types/* 安裝"Cannot find name" 錯誤。lib 版本"Property X does not exist on type Y"。moduleResolutionnode、bundler 等)與實際運行環境相符,否則會出現 "Cannot find module" 錯誤。include / exclude 路徑| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-16 | pass→pass | 11,849 | 12,455 | +5% | 1 | 1 | 0% | 2,118 | 3,016 | +42% | 0 | 0 | — |
case-01 | fail→pass | 8,530 | 4,566 | -46% | 1 | 1 | 0% | 1,620 | 1,827 | +13% | 0 | 0 | — |
case-02 | pass→pass | 10,177 | 4,352 | -57% | 1 | 1 | 0% | 1,686 | 1,740 | +3% | 0 | 0 | — |
case-03 | pass→pass | 14,802 | 14,009 | -5% | 1 | 1 | 0% | 2,342 | 3,264 | +39% | 0 | 0 | — |
case-04 | fail→pass | 8,845 | 4,321 | -51% | 1 | 1 | 0% | 1,670 | 1,700 | +2% | 0 | 0 | — |
case-05 | fail→pass | 6,618 | 5,342 | -19% | 1 | 1 | 0% | 1,158 | 1,955 | +69% | 0 | 0 | — |
case-06 | pass→pass | 4,272 | 4,301 | +1% | 1 | 1 | 0% | 788 | 1,659 | +111% | 0 | 0 | — |
case-07 | pass→pass | 6,149 | 5,330 | -13% | 1 | 1 | 0% | 1,127 | 1,741 | +54% | 0 | 0 | — |
case-08 | pass→pass | 10,530 | 9,787 | -7% | 1 | 1 | 0% | 1,890 | 2,794 | +48% | 0 | 0 | — |
case-09 | pass→pass | 7,267 | 5,424 | -25% | 1 | 1 | 0% | 1,190 | 1,755 | +47% | 0 | 0 | — |
case-10 | pass→pass | 3,850 | 3,309 | -14% | 1 | 1 | 0% | 671 | 1,392 | +107% | 0 | 0 | — |
case-11 | pass→pass | 12,407 | 10,208 | -18% | 1 | 1 | 0% | 2,361 | 2,927 | +24% | 0 | 0 | — |
case-12 | pass→pass | 14,561 | 8,377 | -42% | 1 | 1 | 0% | 2,360 | 2,682 | +14% | 0 | 0 | — |
case-13 | pass→pass | 11,612 | 12,763 | +10% | 1 | 1 | 0% | 2,285 | 3,369 | +47% | 0 | 0 | — |
case-14 | pass→pass | 9,536 | 8,770 | -8% | 1 | 1 | 0% | 1,864 | 2,294 | +23% | 0 | 0 | — |
case-15 | pass→pass | 15,215 | 13,204 | -13% | 1 | 1 | 0% | 2,476 | 3,183 | +29% | 0 | 0 | — |
case-17 | pass→pass | 9,993 | 8,760 | -12% | 1 | 1 | 0% | 1,876 | 2,454 | +31% | 0 | 0 | — |
case-18 | pass→pass | 7,624 | 2,138 | -72% | 1 | 1 | 0% | 1,336 | 1,302 | -3% | 0 | 0 | — |
case-19 | pass→pass | 9,921 | 2,301 | -77% | 1 | 1 | 0% | 1,856 | 1,320 | -29% | 0 | 0 | — |
case-20 | pass→pass | 8,765 | 4,683 | -47% | 1 | 1 | 0% | 1,530 | 1,679 | +10% | 0 | 0 | — |
case-21 | pass→pass | 5,144 | 4,436 | -14% | 1 | 1 | 0% | 877 | 1,750 | +100% | 0 | 0 | — |
case-22 | pass→pass | 13,723 | 12,019 | -12% | 1 | 1 | 0% | 2,407 | 3,019 | +25% | 0 | 0 | — |
case-23 | pass→pass | 14,560 | 11,830 | -19% | 1 | 1 | 0% | 2,466 | 2,987 | +21% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.