marius-townhouse/effective-typescript-skills

three-versions-types

Use when publishing type declarations. Use when dealing with version conflicts. Use when libraries have types. Use when managing @types packages. Use when debugging type mismatches.

First seen Feb 3, 2026

Installation

$ npx skills add marius-townhouse/effective-typescript-skills --skill three-versions-types

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from marius-townhouse/effective-typescript-skills · top by installs.

npx skills add marius-townhouse/effective-typescript-skills

Browse all from marius-townhouse/effective-typescript-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 5
License LICENSE
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,248 B
  • docs SUMMARY.md 209 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 31 installs

SKILL.md

Understand the Three Versions Involved in Type Declarations

Overview

When working with TypeScript types, three versions must align: the version of the package you're using, the version of its type declarations (@types), and the version of TypeScript itself. Misalignment between these versions can cause confusing type errors even when the code works at runtime.

Understanding these three versions helps diagnose and prevent type compatibility issues.

The Three Versions

  1. Package version - The runtime library (e.g., [email protected])
  2. @types version - Type declarations (e.g., @types/[email protected])
  3. TypeScript version - Your TypeScript compiler (e.g., [email protected])

When to Use This Skill

  • Publishing type declarations
  • Debugging version conflicts
  • Working with @types packages
  • Managing library dependencies
  • Type errors that don't match runtime behavior

The Iron Rule

Keep package, @types, and TypeScript versions compatible. Update them together to avoid mysterious type errors.

Common Version Issues

// Package updated but @types not updated
import { newFeature } from 'library';  // Runtime works
// Error: Module 'library' has no exported member 'newFeature'

// TypeScript too old for new type features
// Error: Type instantiation is excessively deep
// (Newer @types use features old TS doesn't support)

// @types too new for package version
// Types reference features not in actual package

Best Practices

// package.json
{
  "dependencies": {
    "lodash": "^4.17.21"
  },
  "devDependencies": {
    "@types/lodash": "^4.14.191",
    "typescript": "^5.2.2"
  }
}

Checking Versions

# Check all three versions
npm ls lodash @types/lodash typescript

# Check for outdated packages
npm outdated

# Update together
npm update lodash @types/lodash typescript

Reference

  • Effective TypeScript, 2nd Edition by Dan Vanderkam
  • Item 66: Understand the Three Versions Involved in Type Declarations