typescript-type-expert

Diagnose and resolve complex TypeScript type system errors and performance issues.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill typescript-type-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-type-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/typescript-type
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill typescript-type-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript developers frequently hit cryptic compiler errors like "Type instantiation is excessively deep", circular type references, slow type checking, and generic constraint failures that are hard to diagnose and fix without deep type-system knowledge. ## Core Features & Use Cases - Error Pattern Resolution: Provides root-cause analysis and prioritized solutions for 18 advanced type system error patterns covering generics, conditional types, template literals, and module augmentation. - Type-Level Programming Patterns: Includes ready-to-use implementations of brand types, recursive types with depth limiting, distributive conditional control, and template literal parsing. - Performance Optimization: Offers diagnostic commands (tsc --extendedDiagnostics, --generateTrace) and refactoring strategies for slow compilation and out-of-memory failures. - Use Case: When a recursive mapped type triggers "Type instantiation is excessively deep and possibly infinite", apply the depth-limiting tuple counter pattern to cap recursion and restore compilation. ## Quick Start Ask the agent to diagnose and fix the TypeScript error "Type instantiation is excessively deep and possibly infinite" in your recursive type definition.

Frequently Asked Questions about typescript-type-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix "Type instantiation is excessively deep and possibly infinite" in TypeScript?

This error comes from recursive type definitions without termination conditions. Fix it by adding a depth-limiting tuple counter to the conditional type, using type assertions as escape hatches, or redesigning the type hierarchy to avoid deep recursion.

How to create branded types for nominal typing in TypeScript?

Declare a unique symbol as a brand key and intersect the base type with an object containing that symbol. Add constructor functions with runtime validation so values like UserId and OrderId cannot be accidentally swapped at compile time.

Why is TypeScript type checking so slow and how do I diagnose it?

Slow checking usually comes from complex unions or deeply instantiated types. Run tsc --extendedDiagnostics or --generateTrace to measure check time, then break large unions into discriminated unions and prefer interface extension over heavy intersections.

What is the difference between distributive and non-distributive conditional types?

Conditional types distribute over union members by default, applying the check to each member separately. Wrapping the checked type in a tuple, like [T] extends [U], disables distribution so the union is evaluated as a whole.

When should I use an interface instead of a type alias in TypeScript?

Use interfaces for self-referencing or mutually recursive structures, since type aliases cannot legally reference themselves directly. Interfaces also perform better than large intersection types and support declaration merging for module augmentation.