marius-townhouse/effective-typescript-skills

module-augmentation

Use when extending third-party types. Use when adding properties to existing interfaces. Use when plugins extend core types. Use when declaration merging is needed. Use when augmenting global types.

First seen Feb 3, 2026

Installation

$ npx skills add marius-townhouse/effective-typescript-skills --skill module-augmentation

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 1,445 B
  • docs SUMMARY.md 225 B

History

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

SKILL.md

Use Module Augmentation to Improve Types

Overview

Module augmentation allows you to add declarations to existing modules, including third-party libraries. This is useful when a library's types are incomplete or when you're extending a library with plugins. Use declare module to add properties, methods, or types to existing modules.

When to Use This Skill

  • Extending third-party types
  • Adding properties to existing interfaces
  • Plugins that extend core types
  • Declaration merging needed
  • Augmenting global types

The Iron Rule

Use module augmentation to add to existing types. Declare the same module name and add your declarations.

Example

// Adding to an existing module
// types/vue.d.ts
declare module 'vue' {
  export interface ComponentCustomProperties {
    $myProperty: string;
    $myMethod(): void;
  }
}

// Now Vue components have these properties
// this.$myProperty works with type safety

// Augmenting global types
declare global {
  interface Window {
    myLib: MyLibrary;
  }
}

// Now window.myLib is typed

Reference

  • Effective TypeScript, 2nd Edition by Dan Vanderkam
  • Item 71: Use Module Augmentation to Improve Types