🎯

three-versions-types

🎯Skill

from marius-townhouse/effective-typescript-skills

VibeIndex|
What it does

Diagnose and resolve TypeScript type declaration version conflicts by aligning package, @types, and TypeScript compiler versions.

πŸ“¦

Part of

marius-townhouse/effective-typescript-skills(83 items)

three-versions-types

Installation

Quick InstallInstall with npx
npx skills add marius-townhouse/effective-typescript-skills --all
Quick InstallInstall with npx
npx skills add marius-townhouse/effective-typescript-skills -s prefer-unknown-over-any exhaustiveness-checking
Quick InstallInstall with npx
npx skills add marius-townhouse/effective-typescript-skills -a opencode claude-code
Quick InstallInstall with npx
npx skills add marius-townhouse/effective-typescript-skills -l
git cloneClone repository
git clone https://github.com/marius-townhouse/effective-typescript-skills.git
πŸ“– Extracted from docs: marius-townhouse/effective-typescript-skills
1Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

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.

Overview

# 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., lodash@4.17.21)
  2. @types version - Type declarations (e.g., @types/lodash@4.14.191)
  3. TypeScript version - Your TypeScript compiler (e.g., typescript@5.2.2)

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

```typescript

// 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

```json

// package.json

{

"dependencies": {

"lodash": "^4.17.21"

},

"devDependencies": {

"@types/lodash": "^4.14.191",

"typescript": "^5.2.2"

}

}

```

Checking Versions

```bash

# 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

More from this repository10

🎯
tsdoc-comments🎯Skill

Generates TypeScript documentation comments (TSDoc) to explain public APIs, complex types, and provide comprehensive code documentation with IDE tooltips.

🎯
async-over-callbacks🎯Skill

Transforms callback-based asynchronous code into clean, readable async/await patterns for better type flow and error handling.

🎯
type-safe-monkey-patching🎯Skill

Enables type-safe runtime extension of global objects and DOM elements in TypeScript without sacrificing type checking or using `as any`.

🎯
create-objects-all-at-once🎯Skill

Efficiently initializes multiple TypeScript objects simultaneously using concise object literal syntax and spread operators.

🎯
module-by-module-migration🎯Skill

Guides developers through systematic TypeScript module migration, breaking down complex refactoring into manageable, incremental steps.

🎯
ts-js-relationship🎯Skill

Explains TypeScript's relationship to JavaScript, highlighting how it adds static typing and catches errors before runtime while remaining fully compatible with JavaScript code.

🎯
code-gen-independent🎯Skill

Generates JavaScript code despite TypeScript type errors and demonstrates that TypeScript types are erased at runtime, requiring alternative type checking strategies.

🎯
context-type-inference🎯Skill

Helps restore precise type context when extracting values, preventing type inference errors through annotations, const assertions, and type preservation techniques.

🎯
precise-string-types🎯Skill

Enforces strict string type constraints and prevents unintended string type conversions in TypeScript projects.

🎯
type-display-attention🎯Skill

Displays and simplifies complex TypeScript types to improve IDE readability and developer experience.