Skill

Master TypeScript for Robust Code

Expert TypeScript guidance: type-level programming, performance debugging, migration, tooling decisions, and code review.

Works with githubbiomeeslintprettiervitest

80
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Leverage advanced TypeScript expertise to analyze, debug, and optimize your codebase, ensuring type safety, performance, and adherence to best practices.

Outcomes

What it gets done

01

Analyze project setup and tooling.

02

Identify and resolve complex TypeScript errors.

03

Optimize type-level programming and build performance.

04

Provide guidance on migration and monorepo strategies.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-typescript-expert | bash

Overview

TypeScript Expert

Advanced TypeScript expertise: type-level programming (branded types, conditional types, satisfies), performance diagnosis, real-world compiler error debugging, JS-to-TS migration, monorepo/tooling decisions, and a code review checklist. Use for type-level programming, TypeScript performance issues, migration planning, or tooling decisions; defers bundler internals, ESM/CJS migration, and type-performance profiling to sibling expert skills.

What it does

This skill provides advanced, practical TypeScript expertise spanning type-level programming (branded/nominal types to prevent primitive obsession, recursive conditional types like DeepReadonly<T> with depth-limiting to avoid instantiation errors, template literal type patterns, satisfies for constraint validation without losing literal types, as const for maximum inference), performance diagnosis (tsc --extendedDiagnostics/--generateTrace for slow type checking, skipLibCheck/incremental/project references as fixes, common causes of "Type instantiation is excessively deep"), and real-world error resolution (missing type exports, circular dependencies via type-only imports, ambient .d.ts declarations for untyped packages, module resolution mysteries, and the fact that TypeScript path mapping only works at compile time, not runtime).

It covers incremental JavaScript-to-TypeScript migration (allowJs/checkJs first, file-by-file renaming, ts-migrate/typesync tooling), concrete tool-migration decision tables (ESLint+Prettier to Biome, Lerna to Nx/Turborepo, CJS to ESM), a Nx-vs-Turborepo decision matrix (Turborepo for <20 packages needing speed, Nx for complex/large monorepos), TypeScript project-references configuration for monorepos, a Biome-vs-ESLint tradeoff (Biome faster but no type-aware linting yet), Vitest-based type testing (expectTypeOf) for libraries and generic APIs, and a comprehensive code review checklist across type safety, TypeScript idioms, performance, module system, error handling, and code organization. It opens by explicitly deferring to narrower experts when needed - bundler internals to typescript-build-expert, ESM/CJS migration and circular dependency analysis to typescript-module-expert, and type-performance/compiler-internals profiling to typescript-type-expert - and follows a fixed workflow: detect the project's tooling/monorepo setup first (preferring Read/Grep/Glob over shell), apply the right strategy, then validate with fast one-shot typecheck/test/build commands rather than long-lived watch processes.

When to use - and when NOT to

Use this skill for type-level programming problems, TypeScript performance issues (slow compilation, excessive type depth), real-world compiler error debugging, JavaScript-to-TypeScript migration planning, monorepo tooling decisions, or a structured TypeScript code review.

Do not use it for ultra-specific bundler internals, deep ESM/CJS circular-dependency untangling, or compiler-internals type-performance profiling - the skill explicitly hands those off to its three sibling experts rather than attempting them itself.

Inputs and outputs

Input is a TypeScript codebase, error message, performance complaint, or migration/tooling decision. Output follows a fixed loop: detect project setup (TS/Node versions, tooling, monorepo structure), identify the problem category, apply the matching solution (a type pattern, a config fix, a migration step), then validate with typecheck/test/build commands run once rather than in watch mode.

npx tsc --extendedDiagnostics --incremental false

Integrations

Works across the TypeScript compiler (tsc), Vitest for type testing, Biome and ESLint/typescript-eslint for linting, Nx and Turborepo for monorepo builds, and migration tools ts-migrate/typesync. Delegates to typescript-build-expert, typescript-module-expert, and typescript-type-expert for narrower expertise.

Who it's for

TypeScript developers debugging complex type errors or performance issues, migrating JavaScript codebases, choosing between modern tooling (Biome/ESLint, Nx/Turborepo), or conducting a thorough TypeScript-specific code review.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.