Skip to content

Add a published .d.ts diff to the release process to catch breaking type changes #749

Description

@tyler-reitz

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:

  1. npm pack the latest published version, extract dist/*.d.ts.
  2. npm pack the release candidate, extract dist/*.d.ts.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions