typescript-type_skill

This skill helps you master advanced TypeScript types, generics, and template literals to solve complex type-level challenges efficiently.
  • TypeScript

60

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill cin12211/orca-q --skill typescript-type

  • SKILL.md22.3 KB

Overview

This skill is an advanced TypeScript type system specialist focused on complex generics, conditional types, template literal manipulation, recursive types, and type-level performance. It helps diagnose and resolve deep instantiation errors, variance problems, template literal parsing, inference failures, and slow type-checking. Use it to design robust utility types, branded nominal types, and scalable type hierarchies.

How this skill works

The skill inspects TypeScript type errors and code patterns to identify root causes such as infinite recursion, distributive conditional surprises, improper keyof usage, and module/export mismatches. It proposes targeted fixes: limiting recursion depth, introducing brand types, wrapping conditional checks to control distribution, refactoring heavy unions into discriminated unions, and applying compiler flags or incremental builds for performance. It also provides small, copy-pasteable type recipes and diagnostics commands.

When to use it

  • You hit "Type instantiation is excessively deep" or runaway recursive types.
  • Generic variance or constraint errors like "T could be instantiated with a different subtype".
  • Template literal types fail to parse or complex string-to-type transformations are needed.
  • Type inference or narrowing is failing (unknown, null/undefined, or assertion gaps).
  • Type-checking is extremely slow or runs out of memory on large types.
  • You need library declaration fixes: module augmentation, default export issues, or packaging-safe types.

Best practices

  • Limit recursion depth with tuple counters or fallbacks to avoid infinite instantiation.
  • Prefer interfaces for self-referential structures and break cycles via indirection.
  • Use branded types to enforce nominal distinctions and avoid accidental swaps.
  • Control conditional distribution by wrapping types in tuples to get non-distributive behavior.
  • Group and compose unions as discriminated variants to reduce type complexity and improve performance.
  • Use compiler options (incremental, skipLibCheck, composite) and trace tools to diagnose slowness.

Example use cases

  • Authoring a deep-safe DeepPartial that stops recursion after N levels.
  • Converting kebab-case or snake_case strings to CamelCase at the type level for typed route keys.
  • Fixing an API client where union explosion causes tsc to run out of memory by splitting types.
  • Creating branded UserId and OrderId types to prevent accidental parameter swaps in functions.
  • Resolving "module has no default export" by converting imports or adjusting moduleResolution and esModuleInterop.

FAQ

Introduce a depth counter (tuple length) or provide a fallback any/primitive after N recursions, or refactor to a less-deep representation.

When should I use a branded type?

Use branded types when you need nominal safety (distinct string/number aliases) to prevent mixing logically different IDs or tokens.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational