rushstack/apps/api-extractor
Rushbot 300fcd107d Bump versions [skip ci] 2024-10-17 08:35:09 +00:00
..
.vscode Add a test case to repro GitHub #2797 2021-07-08 16:11:17 -07:00
bin prettier -w . 2024-05-23 10:37:48 -07:00
config Fix caching for other projects. 2023-09-19 12:11:11 -07:00
extends
src [api-extractor] pass compilerOptions into getModeForUsageLocation to fix TS 5.6 (#4973) 2024-10-14 13:31:43 -07:00
.eslintrc.js Rename eslint-config-local to local-eslint-config. 2023-09-26 01:23:24 -07:00
.npmignore Include CHANGELOG.md in published releases again (#4851) 2024-07-26 10:33:37 -07:00
CHANGELOG.json Update changelogs [skip ci] 2024-10-17 08:35:07 +00:00
CHANGELOG.md Update changelogs [skip ci] 2024-10-17 08:35:07 +00:00
LICENSE
README.md Fix hyperlinks that were broken when API docs were moved to the api.rushstack.io subsite 2024-02-16 19:00:01 -08:00
ae.cmd
build-tests.cmd Update build-tests.cmd using a Rush tag 2023-10-13 16:14:24 -07:00
package.json Bump versions [skip ci] 2024-10-17 08:35:09 +00:00
tsconfig.json Turn on some stricter compiler options. 2024-05-28 21:58:04 -07:00

README.md

@microsoft/api-extractor

API Extractor
      https://api-extractor.com/

API Extractor helps you build better TypeScript library packages. Suppose for example that your company has published an NPM package called "awesome-widgets" that exports many classes and interfaces. As developers start to depend on your library, you may encounter issues such as...

  • Accidental breaks: People keep reporting that their code won't compile after a supposedly "minor" update. To address this, you boldly propose that every awesome-widgets pull request must be approved by an experienced developer from your team. But that proves unrealistic -- nobody has time to look at every single PR! What you really need is a way to detect PRs that change API contracts, and flag them for review. That would focus attention in the right place... but how to do that?

  • Missing exports: Suppose the awesome-widgets package exports an API function AwesomeButton.draw() that requires a parameter of type DrawStyle, but you forgot to export this enum. Things seem fine at first, but when a developer tries to call that function, they discover that there's no way to specify the DrawStyle. How to avoid these oversights?

  • Accidental exports: You meant for your DrawHelper class to be kept internal, but one day you realize it's being exported. When you try to remove it, consumers complain that they're using it. How do we avoid this in the future?

  • Alpha/Beta graduation: You want to release previews of new APIs that are not ready for prime time yet. But if you did a major SemVer bump every time these definitions evolve, the villagers would be after you with torches and pitchforks! A better approach is to designate certain classes/members as alpha quality, then promote them to beta and finally to public as they mature. But how to indicate this to your consumers? (And how to detect scoping mistakes? A public function should never return a beta result.)

  • *.d.ts rollup: You webpacked your library into a nice *.js bundle file -- so why ship your typings as a messy tree of lib/*.d.ts files full of private definitions? Can't we consolidate them into a tidy *.d.ts rollup file? And if you publish internal/beta/public releases, each release type should get its own *.d.ts file with appropriate trimming. Developers building a production project don't want to see a bunch of internal and beta members in their VS Code IntelliSense!

  • Online documentation: You have faithfully annotated each TypeScript member with nice TSDoc descriptions. Now that your library has shipped, it's time to set up a nicely formatted API reference. What tool to use?

API Extractor provides an integrated, professional-quality solution for all these problems. It is invoked at build time by your toolchain and leverages the TypeScript compiler engine to:

  • Detect a project's exported API surface
  • Capture the contracts in a concise report designed to facilitate review
  • Warn about common mistakes (e.g. missing exports, inconsistent visibility, etc.)
  • Generate *.d.ts rollups with trimming according to release type
  • Output API documentation in a portable format that's easy to integrate with your content pipeline

Best of all, API Extractor is free and open source. Join the community and create a pull request!

Getting Started

For more details and support resources, please visit: https://api-extractor.com/

API Extractor is part of the Rush Stack family of projects.