Problem
4.2.4 shipped as a patch but contained breaking TypeScript type changes with no changelog note. The main one: ObservableStatus<T> was refactored from a flat interface (data: T) into a discriminated union (data: T | undefined unless narrowed on status), which breaks the standard destructure-and-use pattern across every data hook, including the documented suspense pattern. It is type-only (no runtime impact), but it reds strict-TS consumer CI on upgrade.
It slipped through because:
Proposal
Add a release-time (or CI) check that diffs the candidate's emitted types against the last published version:
npm pack the latest published version, extract dist/*.d.ts.
npm pack the release candidate, extract dist/*.d.ts.
- Diff them. Any non-additive change (removed/narrowed/changed signature) fails the check or requires an explicit "breaking" acknowledgment and a minor/major bump.
This exact diff would have flagged both the ObservableStatus union change and the useFirestoreDocData widening (#733) immediately.
Related
Problem
4.2.4 shipped as a patch but contained breaking TypeScript type changes with no changelog note. The main one:
ObservableStatus<T>was refactored from a flat interface (data: T) into a discriminated union (data: T | undefinedunless narrowed onstatus), which breaks the standard destructure-and-use pattern across every data hook, including the documented suspense pattern. It is type-only (no runtime impact), but it reds strict-TS consumer CI on upgrade.It slipped through because:
useSyncExternalStoreto sync data inuseObservable#583 ("useuseSyncExternalStoreto sync data"), whose title looked like an internals change, not a public API break.useSyncExternalStoreto sync data inuseObservable#583 merged 2023-07).maininto one bump, with no step auditing the cumulative public type surface.Proposal
Add a release-time (or CI) check that diffs the candidate's emitted types against the last published version:
npm packthe latest published version, extractdist/*.d.ts.npm packthe release candidate, extractdist/*.d.ts.This exact diff would have flagged both the
ObservableStatusunion change and theuseFirestoreDocDatawidening (#733) immediately.Related