Back to list
robertlupo1997

typescript-pro

by robertlupo1997

Text-prompted object detection + segmentation with Grounding DINO + SAM 2. ~265–490 ms/img on RTX 3070. COCO eval + Streamlit demo.

0🍴 0📅 Jan 12, 2026

SKILL.md


name: typescript-pro description: Advanced TypeScript development with full type safety. Use when: (1) designing complex generic types or utility types, (2) achieving end-to-end type safety (tRPC, GraphQL codegen), (3) optimizing TypeScript build performance, (4) migrating JavaScript to TypeScript, (5) authoring type-safe libraries, (6) debugging complex type errors.

TypeScript Pro

Workflow

  1. Audit - Review tsconfig strictness, type coverage, build times
  2. Design - Define domain types first, derive others with mapped/conditional types
  3. Implement - Use type inference, avoid explicit types where inferred
  4. Validate - Test types with expectType, check edge cases
  5. Optimize - Profile tsc, use project references for large codebases

Strict Mode Essentials

// tsconfig.json - non-negotiable settings
{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  }
}

Type Patterns

Branded Types (nominal typing)

type UserId = string & { readonly __brand: 'UserId' };
type OrderId = string & { readonly __brand: 'OrderId' };

// Prevents mixing up IDs even though both are strings
function getUser(id: UserId) { /* ... */ }

Discriminated Unions (state machines)

type State =
  | { status: 'idle' }
  | { status: 'loading' }
  | { status: 'success'; data: Data }
  | { status: 'error'; error: Error };

// Exhaustive checking with never
function handle(state: State) {
  switch (state.status) {
    case 'idle': return /* ... */;
    case 'loading': return /* ... */;
    case 'success': return state.data;
    case 'error': return state.error;
    default: return state satisfies never;
  }
}

Const Assertions

// Without: routes is string[]
const routes = ['home', 'about', 'contact'];

// With: routes is readonly ['home', 'about', 'contact']
const routes = ['home', 'about', 'contact'] as const;
type Route = typeof routes[number]; // 'home' | 'about' | 'contact'

Build Performance

ProblemSolution
Slow full buildsProject references, incremental: true
Slow IDEExclude node_modules, use skipLibCheck
Large bundlesisolatedModules, type-only imports
CI bottleneckCache .tsbuildinfo, parallel type-check

End-to-End Type Safety

Database → ORM types → API types → Client types
         Prisma       tRPC/Zod    Inferred
  • tRPC: Types flow from backend to frontend automatically
  • Zod: Runtime validation + TypeScript types from one source
  • Prisma: Database schema generates TypeScript types

Common Type Errors Decoded

ErrorMeaningFix
Type 'X' is not assignable to type 'Y'Shape mismatchCheck property names/types
'X' is possibly 'undefined'Nullable accessAdd null check or ! (carefully)
Type instantiation is excessively deepRecursive type limitSimplify or add base case
Cannot find name 'X'Missing import/declarationImport or declare ambient type

Library Authoring Checklist

  • declaration: true in tsconfig
  • Export types explicitly in package.json exports
  • Test types with @ts-expect-error comments
  • Support both ESM and CJS if needed
  • Document generic constraints in JSDoc

Score

Total Score

70/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon