module-augmentation

Extend TypeScript module and global type declarations with declare module patterns.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill module-augmentation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: module-augmentation
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/module-augmentation
Command: npx skills add https://github.com/luyi985/lyi-bash --skill module-augmentation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Module augmentation lets you extend existing module typings by adding declarations to third-party libraries or to global interfaces. This enables richer type safety and customization without altering library sources.

Core Features & Use Cases

  • Extend existing type declarations by adding properties, methods, or types to modules.
  • Augment global typings for applications that rely on global interfaces.
  • Support plugins and integrations that ship incomplete typings by providing extended declarations.

Quick Start

Declare the module or global types you need to augment with appropriate TypeScript syntax to augment the typings in your project.

Frequently Asked Questions about module-augmentation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extend TypeScript type declarations for a third-party library without modifying its source code?

Module augmentation lets you extend existing module typings by adding declarations to third-party libraries or global interfaces, enabling richer type safety and customization without altering library sources.

What is the difference between declare module and declare global patterns in TypeScript?

The declare module pattern safely extends specific module typings with conflict-free augmentation, while declare global extends global typings for applications that rely on global interfaces.

How do I add custom typings for a plugin that ships incomplete TypeScript definitions?

You can support plugins and integrations with incomplete typings by using declare module to provide extended declarations and improve type safety across your codebase.

Can I safely augment existing module interfaces in TypeScript without causing type conflicts?

Yes, module augmentation supports conflict-free augmentation to safely extend modules and global interfaces, ensuring improved type safety when integrating third-party libraries.

When do I need to augment global typings in a TypeScript project?

You need to augment global typings when your application relies on global interfaces that require extended declarations for richer type safety and customization.