export-public-types

Export all TypeScript types that appear in public library APIs.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill export-public-types-pohlai88
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: export-public-types
Source: https://github.com/pohlai88/afenda-xforge-v5/tree/main/.agents/skills/export-public-types
Command: npx skills add https://github.com/pohlai88/afenda-xforge-v5 --skill export-public-types-pohlai88

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When publishing TypeScript libraries, internal types used in public function signatures are often left unexported, preventing consumers from typing their own variables and degrading the developer experience. ## Core Features & Use Cases - Public API Type Audit: Identifies types appearing in public function signatures, return types, and interfaces that must be exported. - Before/After Examples: Shows concrete bad and good patterns for exporting types like User alongside functions like getUser. - Use Case: When publishing a reusable component library or npm package, ensure consumers can write import { getUser, User } from 'library' and annotate their own variables with your types. ## Quick Start Review my library's public API and export every TypeScript type that appears in exported function signatures or interfaces.

Frequently Asked Questions about export-public-types

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

FAQPage Schema
How do I export types from a TypeScript library's public API?

Add the export keyword to every interface or type alias that appears in public function signatures, return types, or interfaces. For example, export interface User alongside export function getUser so consumers can import both.

Why should types in public APIs be exported in TypeScript?

If a function returns a type that is not exported, consumers cannot annotate their own variables with that type or reference it in their code. Exporting these types is essential for a usable library API and good developer experience.

What happens if a TypeScript library does not export its types?

Consumers get errors when trying to import the type, forcing them to use workarounds like ReturnType<typeof getUser> or duplicating type definitions. This creates fragile code that breaks when the library's types change.

When should I apply this type-exporting rule?

Apply it whenever publishing TypeScript libraries, building reusable components, or designing library interfaces where types appear in public function signatures. It is based on Item 67 of Effective TypeScript by Dan Vanderkam.