Skip to content

Stop checking in generated .d.ts; keep only public API snapshots (#1801) - #1801

Closed
robhogan wants to merge 2 commits into
mainfrom
export-D112750746
Closed

Stop checking in generated .d.ts; keep only public API snapshots (#1801)#1801
robhogan wants to merge 2 commits into
mainfrom
export-D112750746

Conversation

@robhogan

@robhogan robhogan commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary:

Makes the per-package TypeScript definition files (packages/*/types/*.d.ts) build artefacts instead of checked-in source, now that microsoft/api-extractor gives us snapshots of public APIs.

Note - .d.ts files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the public API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 28, 2026
@meta-codesync

meta-codesync Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112750746.

robhogan added a commit that referenced this pull request Jul 28, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@meta-codesync meta-codesync Bot changed the title Stop checking in generated .d.ts; keep only public API snapshots Stop checking in generated .d.ts; keep only public API snapshots (#1801) Jul 28, 2026
@robhogan
robhogan force-pushed the export-D112750746 branch from a941eea to b520d75 Compare July 28, 2026 13:44
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from b520d75 to 3c6b4f1 Compare July 29, 2026 11:37
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 3c6b4f1 to c206de8 Compare July 29, 2026 11:41
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from c206de8 to 0605915 Compare July 29, 2026 11:46
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 0605915 to 6328692 Compare July 29, 2026 12:01
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 6328692 to 8ce230c Compare July 29, 2026 12:49
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 8ce230c to f839f3a Compare July 29, 2026 13:04
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from f839f3a to dfdea2c Compare July 29, 2026 13:58
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from dfdea2c to 075d46b Compare July 29, 2026 14:29
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 075d46b to 3d2df24 Compare July 29, 2026 15:12
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 3d2df24 to 63279df Compare July 29, 2026 15:17
Summary:
Adds Microsoft's `microsoft/api-extractor` (7.52.2) as a Metro dev
dependency and builds a system that captures a public API snapshot for
each OSS package based on its `package.json` `exports` entry points.

- `scripts/generateApiSnapshots.js` enumerates every package, derives the
  public entry points from `exports` (skipping `./package.json`, wildcard
  subpaths like `./private/*`, and entries with no generated `.d.ts`), and
  runs API Extractor over each package's generated TypeScript definitions
  to produce a public API report.
- The report is written to `API.md` at each package root (secondary entry
  points are suffixed, e.g. `API-<subpath>.md`).
- The report is post-processed to drop annotations that are pure noise for
  Metro (whose surface is documented by Flow types, not TSDoc): the
  release-tag comments (`// @public` etc.), `(undocumented)` markers, and
  the "(No packageDocumentation comment...)" notice. Meaningful modifiers
  such as `deprecated` are preserved. API Extractor exposes no config to
  suppress these (they are hardcoded in its ApiReportGenerator), so this is
  done in `cleanReport`.
- Wired into `js1 build metro-ts-defs` (runs after TS-def generation) and
  exposed to OSS as `yarn run build-api-snapshots`.
- `scripts/__tests__/api-snapshots-sync-test.js` fails if a committed
  snapshot is stale, mirroring the existing TS-defs sync test.
- `flow-typed/microsoft-api-extractor.js` provides a local libdef for the
  subset of the API Extractor API used here (Flow does not resolve
  `node_modules`); registered in `xplat/js/.flowconfig` `[libs]`.
- `tsconfig.api-extractor.json` mirrors the project tsconfig plus the `dom`
  lib so API Extractor resolves ambient globals.

14 snapshots are generated; `metro-runtime` runtime-only subpaths,
`metro-babel-register`, and the CLI-only `metro-symbolicate` are skipped
(no exported type surface).

Differential Revision: https://www.internalfb.com/D112750747
robhogan added a commit that referenced this pull request Jul 29, 2026
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 63279df to 231ac20 Compare July 29, 2026 15:24
Summary:
Pull Request resolved: #1801

Makes the per-package TypeScript definition files (`packages/*/types/*.d.ts`) build artefacts instead of checked-in source, now that `microsoft/api-extractor` gives us snapshots of public APIs.

Note - `.d.ts` files are still emitted for every module at build time and published to npm.

The main benefit of this is to reduce developer friction - previously, any change to a module's API would require rebuilding TS definitions. Now, a manual step is only required when changing the *public* API, which is both much less common and should always be done intentionally.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D112750746
@robhogan
robhogan force-pushed the export-D112750746 branch from 231ac20 to 441ae6f Compare July 29, 2026 15:28
@meta-codesync meta-codesync Bot closed this in b43fcf0 Jul 29, 2026
@meta-codesync meta-codesync Bot added the Merged label Jul 29, 2026
@meta-codesync

meta-codesync Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in b43fcf0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant