export-public-types

Export all types from public API signatures, return types, and interfaces.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When you publish a library, users need access to all types that appear in your public API. If a function returns a type that isn't exported, users can't type their own variables to match.

Core Features & Use Cases

  • Export all types that appear in public function signatures, return types, or interfaces.
  • Maintain alignment across multi-package repositories so consumers can reference types.
  • Example: A library exposes interfaces User and Result<T>; exporting these types allows users to import { User, Result } from 'library'.

Quick Start

Export every type that appears in your library's public API to ensure users can reference it.

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 public API types in a TypeScript library so consumers can use them?

To export public API types in a TypeScript library, you must identify and export every type appearing in public function signatures, return types, and interfaces. This ensures library consumers can import and reference those types directly from the module.

Why does TypeScript require exporting types that appear in public API signatures?

Exporting types in public API signatures is required because if a function returns an unexported type, library consumers cannot properly type their own variables to match. Discoverable types from public declarations keep module boundaries aligned for users.

How do I keep exported types in sync across a multi-package TypeScript repository?

Keeping exported types in sync across a multi-package TypeScript repository requires maintaining alignment across module boundaries and library packaging. You must export every type from public API declarations so consumers in different packages can reference them consistently.

What types need to be exported for library consumers to reference in TypeScript?

Types that need to be exported for library consumers include all types appearing in public function signatures, return types, and exposed interfaces. Exporting these public API declarations allows users to import and use them, such as importing User and Result from a library.

Can I use this approach to export types for frameworks beyond standard TypeScript libraries?

Yes, you can use this approach to export types for frameworks beyond standard TypeScript libraries. The technique applies to any framework where types must be discoverable from public signatures, return types, and interfaces to ensure library consumers can reference them.