Source-backed rules for reviewing TypeScript API client compatibility before merge, with exported type-surface diffs, inferred router inputs and outputs, runtime validator alignment, downstream compile checks, and privacy-safe evidence.
A TypeScript API change can compile in the edited package while breaking frontend consumers, generated clients, cache invalidation, form validation, or error handling in another workspace., Generated declaration files, SDK clients, and API reports should be regenerated from reviewed source and inspected before commit; stale generated output can make reviewers approve the wrong contract., Runtime validators and inferred types must be reviewed together because a type-only change can still accept or reject different data at runtime.
Privacy notes
API client types, API reports, router names, procedure names, schemas, examples, error unions, and generated clients can expose internal routes, unreleased features, auth models, tenant fields, and private payload shapes., Do not paste raw production request bodies, response examples, validation errors, API reports, or downstream compile logs into public comments without redacting private fields and internal identifiers., Use synthetic fixtures for compatibility examples when the client surface includes customer data, billing fields, healthcare data, education records, support tickets, or private workspace metadata.
Author
MkDev11
Submitted by
MkDev11
Claim status
unclaimed
Last verified
2026-06-04
Decision playbook
Review trust signals before you adopt
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
Compare context
Selected
0
Current score
78
Baseline
—
Delta
No baseline selected
No major trust-signal divergence detected in the current selection.
Source and provenance checks
Complete
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Done
Source provenance statusRequired
Marked as source-backed.
Done
Metadata reviewed
Registry metadata indicates a reviewed listing.
Done
Safety and privacy checks
Complete
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Done
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Done
Trust level risk gateRequired
Trust level does not block evaluation.
Done
Package and install checks
Needs review
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Done
Package verification flag
No package verification flag provided.
Pending
Checksum metadata
No checksum provided for downloaded artifact.
Pending
Compare-driven decision checks
Needs review
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
3 safety and 3 privacy notes across 4 risk areas. Review closely: network access.
4 areas
SafetyExecution & processesA TypeScript API change can compile in the edited package while breaking frontend consumers, generated clients, cache invalidation, form validation, or error handling in another workspace.
SafetyLocal filesGenerated declaration files, SDK clients, and API reports should be regenerated from reviewed source and inspected before commit; stale generated output can make reviewers approve the wrong contract.
SafetyExecution & processesRuntime validators and inferred types must be reviewed together because a type-only change can still accept or reject different data at runtime.
PrivacyGeneralAPI client types, API reports, router names, procedure names, schemas, examples, error unions, and generated clients can expose internal routes, unreleased features, auth models, tenant fields, and private payload shapes.
PrivacyNetwork accessDo not paste raw production request bodies, response examples, validation errors, API reports, or downstream compile logs into public comments without redacting private fields and internal identifiers.
PrivacyGeneralUse synthetic fixtures for compatibility examples when the client surface includes customer data, billing fields, healthcare data, education records, support tickets, or private workspace metadata.
Safety notes
A TypeScript API change can compile in the edited package while breaking frontend consumers, generated clients, cache invalidation, form validation, or error handling in another workspace.
Generated declaration files, SDK clients, and API reports should be regenerated from reviewed source and inspected before commit; stale generated output can make reviewers approve the wrong contract.
Runtime validators and inferred types must be reviewed together because a type-only change can still accept or reject different data at runtime.
Privacy notes
API client types, API reports, router names, procedure names, schemas, examples, error unions, and generated clients can expose internal routes, unreleased features, auth models, tenant fields, and private payload shapes.
Do not paste raw production request bodies, response examples, validation errors, API reports, or downstream compile logs into public comments without redacting private fields and internal identifiers.
Use synthetic fixtures for compatibility examples when the client surface includes customer data, billing fields, healthcare data, education records, support tickets, or private workspace metadata.
Prerequisites
A TypeScript web app, package, SDK, typed API client, tRPC router, generated client, or shared types package whose public surface is consumed outside the edited module.
Access to the relevant type-check command, package build, generated declaration output, API report, type tests, and at least one downstream consumer or fixture.
A named owner for client compatibility, deprecation policy, generated artifacts, runtime validators, and release notes.
Permission to block merge when a type-surface change has no downstream compile evidence or safe migration path.
Schema details
Install type
copy
Reading time
6 min
Difficulty score
45
Troubleshooting
Yes
Breaking changes
Yes
Collection metadata
Estimated setup
25 minutes
Difficulty
intermediate
Full copyable content
You are reviewing a TypeScript API client compatibility change for a typed
web app.
Rules:
1. Identify the client-visible contract: exported functions, hooks, router
paths, procedure names, request types, response types, error unions,
cache keys, auth headers, and generated declarations.
2. Require a reviewer-readable type-surface diff, such as an API Extractor
report, declaration diff, type-test diff, or generated client diff.
3. Treat renamed fields, removed exports, narrower inputs, wider nullable
outputs, changed error shapes, and route/procedure moves as compatibility
changes until downstream clients compile and tests pass.
4. Keep runtime validators aligned with exported TypeScript types; do not
hide breakage with any, unsafe casts, stale generated files, or skipped
type checks.
5. Record downstream compile and runtime evidence on the reviewed commit, and
redact request examples, route names, schemas, and payloads when needed.
About this resource
Purpose
Use these rules when a TypeScript web app change can alter what frontend code,
typed SDKs, or downstream packages see as the API client contract. The goal is
to catch compile-time and runtime compatibility breaks before a rename, narrowed
input, changed response shape, or stale generated declaration reaches users.
This is a TypeScript client-surface review policy. It is not an OpenAPI,
JSON Schema, GraphQL, or Pact validation collection, and it does not replace a
full API contract review gate. It tells reviewers how to decide whether a typed
client surface is still safe for its consumers.
Review Inputs
Collect evidence for the client-visible surface before judging the patch.
Consumer map. Frontend routes, apps, packages, examples, tests, SDKs, or
external users that import the changed client or type.
Type evidence. API Extractor report, .d.ts diff, generated SDK diff,
type tests, tsc --noEmit, package build, or downstream fixture compile.
Runtime evidence. Zod or other validator behavior, request examples,
response fixtures, error mapping, cache invalidation, and end-to-end tests.
Release path. Deprecation period, adapter layer, feature flag, migration
note, version boundary, and owner approval for breaking changes.
If the PR cannot name what downstream code imports, require that map before
accepting type-check output from only the edited package.
Compatibility Rules
Treat removed exports, renamed procedures, moved client paths, changed hook
names, altered package entry points, and deleted generated declarations as
breaking until consumers compile.
Treat input changes as breaking when they remove accepted fields, require new
fields, narrow unions, change enum values, alter date or decimal formats, or
move values between path, query, header, and body shapes.
Treat output changes as breaking when they remove fields, change nullability,
widen optionality without consumer review, rename discriminants, or change the
error union that callers branch on.
Keep compatibility shims or deprecated aliases when consumers cannot migrate
in the same release.
Review route and procedure names as part of the contract in typed clients
such as tRPC, even when no OpenAPI document exists.
Require release notes or migration guidance when a consumer must update code,
fixtures, generated clients, or cached data assumptions.
The reviewer should ask: would an existing consumer still compile and still
handle the data shape at runtime after this change?
Type Surface Rules
Use TypeScript evidence that is readable to a reviewer.
Prefer an API Extractor report, declaration diff, generated SDK diff, or type
test that highlights changed exported signatures.
Run type checks after generated clients, declaration files, routers, schema
inference, and package exports have been refreshed.
Do not approve changes that hide incompatibility with any, unknown casts,
broad index signatures, weakened generics, disabled strictness, or skipped
library checks.
Keep exported declaration files aligned with the package entry points that
consumers import.
For inferred clients, review both the source router or schema and the inferred
client type that consumers actually use.
When a package publishes declaration files, inspect changes to public names,
overloads, generic parameters, optional fields, discriminated unions, and
documented release status.
Passing tsc in one package is useful, but it is not enough when the changed
contract is consumed by another package, app, or SDK.
Runtime Validator Rules
Type changes and runtime validation changes must stay aligned.
Update validators and inferred types together when a field is added, removed,
renamed, narrowed, widened, made optional, or made nullable.
Keep parse, transform, default, coercion, and refinement behavior visible in
tests or fixtures when it affects request or response compatibility.
Do not use a type-only edit to imply that runtime payloads changed, or a
validator-only edit to imply that clients received an updated type.
Re-run consumer flows that depend on validation errors, error codes, cache
keys, retries, optimistic updates, or form field mapping.
Confirm that generated clients and declarations reflect the reviewed source
after validator, router, or schema changes.
Runtime validators are part of the contract when they decide what clients may
send and what data the app accepts from the server.
Consumer Evidence Rules
Require evidence on the reviewed commit.
Compile the packages or fixture apps that import the changed client surface.
Run focused tests for changed request inputs, response mapping, errors,
loading states, cache invalidation, retries, and form validation.
Compare generated declaration or API report diffs with the intended change.
Record exact commands, workspaces, commit SHA, generated artifacts, and any
downstream consumers that were not checked.
If compatibility is intentionally broken, require owner approval, migration
notes, and a plan for stale clients.
Do not rely on source-code review alone when a typed client is shared across
workspace boundaries.
Merge Blockers
Block merge until resolved when:
the PR changes a typed client, router, package export, declaration, validator,
generated SDK, or shared DTO without naming downstream consumers;
type checks ran only in the edited package while known consumers were not
compiled;
generated declarations, API reports, or SDK clients are stale, missing, or
inconsistent with source;
compatibility is hidden with any, unsafe casts, disabled strictness, broad
object types, or skipped checks;
validators accept or reject a different runtime shape than the exported type
describes;
renamed fields, removed exports, changed nullability, or altered error unions
lack an adapter, migration note, or owner-approved breaking-change path;
logs, fixtures, API reports, request examples, or validation output expose
private payloads or internal routes in public review comments.
Review Checklist
{"task": "Surface mapped", "description": "Exported clients, types, routers, validators, generated declarations, and consumers are identified"}
{"task": "Type diff reviewed", "description": "API report, declaration diff, generated client diff, or type-test evidence shows the public surface change"}
{"task": "Consumers compile", "description": "Downstream packages, examples, or fixtures compile against the reviewed commit"}
{"task": "Runtime aligned", "description": "Validators, examples, errors, and response mapping match the exported TypeScript types"}
{"task": "Migration covered", "description": "Breaking changes have an adapter, deprecation path, migration note, or owner approval"}
{"task": "Evidence safe", "description": "Logs, reports, examples, route names, and payloads avoid private data and unreleased details"}
AI Review Rules
AI assistants can help find compatibility risk, but they need to show evidence.
Ask the assistant to list exported and inferred client surfaces before asking
for a merge verdict.
Require file paths, package names, import paths, and commands for every
compatibility claim.
Have the assistant separate confirmed consumer breaks from possible breaks it
could not compile.
Do not let the assistant conclude compatibility from server code alone when
consumers import generated or inferred client types.
Re-run review after generated files, declaration output, validators, router
definitions, or package exports change.
Troubleshooting
Only the server package compiles: add a fixture or workspace check that
imports the published client surface the same way consumers do.
The API report changed unexpectedly: inspect the exported signature diff,
decide whether the change is intentional, and regenerate the report from the
reviewed source.
The type got looser to avoid compile errors: restore a precise type and
fix consumers or provide a migration path instead of hiding the breakage.
Runtime accepts data the type rejects: align the validator and exported
type, then add a fixture that proves the intended behavior.
A tRPC procedure moved: treat the procedure path, input, output, and error
shape as the client contract; keep an alias or migration note when consumers
cannot update immediately.
Duplicate And History Check
Checked existing rules, collections, commands, hooks, skills, open PRs, closed
PR history, and issue #736 for API contract review, OpenAPI drift, JSON Schema,
GraphQL schema validation, Pact checks, API-first architecture, tRPC skills,
TypeScript strict mode, generated clients, and typed web app compatibility.
PR #1139 was closed because it repeated the existing
api-contract-review-gate collection with the same OpenAPI, JSON Schema, Pact,
Spectral, and SemVer-centered release gate. This entry intentionally avoids
that lane. It focuses on TypeScript client compatibility: exported declaration
surfaces, API Extractor reports, inferred router inputs and outputs, runtime
validator alignment, downstream compilation, and privacy-safe review evidence
for typed web app consumers.
Declaration Publishing Reference
Field / construct
Handbook guidance
types
Points to your bundled declaration file (for example "types": "./lib/main.d.ts").
typings
Synonymous with types and can be used alternatively.
Declaration dependencies
Must be marked in the "dependencies" section, not "devDependencies", so consumers have access to required type declarations.
/// <reference types="..." />
Use this form to depend on a declaration package.
/// <reference path="..." />
Red flag — do not use this to reference another package's types.
Show that TypeScript API Client Compatibility Review Rules is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/rules/typescript-api-client-compatibility-review-rules)
How it compares
TypeScript API Client Compatibility Review Rules side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
1 trust signal differ across this comparison (Submitter).
Source-backed rules for reviewing TypeScript API client compatibility before merge, with exported type-surface diffs, inferred router inputs and outputs, runtime validator alignment, downstream compile checks, and privacy-safe evidence.
Source-backed rules for reviewing production database migrations before merge with lock-risk checks, expand-contract rollout, backfill controls, rollback limits, and privacy-safe migration evidence.
✓A TypeScript API change can compile in the edited package while breaking frontend consumers, generated clients, cache invalidation, form validation, or error handling in another workspace.
Generated declaration files, SDK clients, and API reports should be regenerated from reviewed source and inspected before commit; stale generated output can make reviewers approve the wrong contract.
Runtime validators and inferred types must be reviewed together because a type-only change can still accept or reject different data at runtime.
✓AI-generated UI can silently replace semantic controls with divs, remove labels, hide focus indicators, break keyboard order, change error messaging, or add motion that affects users.
Automated scans catch important classes of issues but do not prove that custom widgets, focus restoration, reading order, copy meaning, or assistive-technology behavior are correct.
Browser automation and accessibility checks should run against local, preview, or staging environments with test accounts so forms, payments, messages, and destructive actions are not triggered in production.
✓Mutating or deleting a persisted event corrupts the audit log and breaks replays that depend on the original event sequence, potentially causing unrecoverable inconsistency.
A non-backward-compatible event schema change can break all running projections that read older events, causing data loss in read models or replay failures.
A non-idempotent event handler can apply the same event twice on replay or redelivery, producing incorrect aggregate state that is invisible in normal operation but surfaces during recovery.
✓Production migrations can lock tables, rewrite rows, drop data, invalidate indexes, break old application versions, delay deploys, or require backup restore instead of a simple revert.
Generated ORM migrations should be reviewed as SQL or engine-specific operations; do not assume type-safe schema code is operationally safe.
Backfills, constraint validation, index builds, and cleanup migrations should run with batching, monitoring, retry behavior, and stop conditions appropriate to the production workload.
Privacy notes
✓API client types, API reports, router names, procedure names, schemas, examples, error unions, and generated clients can expose internal routes, unreleased features, auth models, tenant fields, and private payload shapes.
Do not paste raw production request bodies, response examples, validation errors, API reports, or downstream compile logs into public comments without redacting private fields and internal identifiers.
Use synthetic fixtures for compatibility examples when the client surface includes customer data, billing fields, healthcare data, education records, support tickets, or private workspace metadata.
✓Accessibility evidence can include screenshots, DOM text, accessible names, form values, labels, user content, network traces, browser storage, cookies, and test account data.
Do not paste raw screenshots, traces, accessibility trees, DOM snapshots, customer names, private routes, or production form data into public PR comments without redaction.
Use synthetic content and test accounts for accessibility examples, especially when reviewing auth, billing, dashboards, healthcare, education, or support flows.
✓Event stores often contain an immutable history of personal data; deletion requests for GDPR or similar regulations must be handled by encryption-key rotation or event compaction, not by deleting events.
Do not include sensitive personal data (passwords, payment card details, health records) directly in event payloads; reference identifiers and look up sensitive data separately.
Be careful with event replay in non-production environments that copy the production event log, since they inherit all personal data in the event history.
✓Migration diffs, dry-run logs, explain plans, table names, column names, row counts, sample rows, tenant IDs, and rollback notes can expose sensitive product or customer information.
Do not paste production rows, unredacted schema snapshots, connection strings, database hostnames, backup locations, or incident-specific migration logs into public PR comments.
When evidence must stay private, leave a minimal public note that names the verification class and owner without exposing database contents or operational secrets.
Prerequisites
A TypeScript web app, package, SDK, typed API client, tRPC router, generated client, or shared types package whose public surface is consumed outside the edited module.
Access to the relevant type-check command, package build, generated declaration output, API report, type tests, and at least one downstream consumer or fixture.
A named owner for client compatibility, deprecation policy, generated artifacts, runtime validators, and release notes.
Permission to block merge when a type-surface change has no downstream compile evidence or safe migration path.
A frontend pull request, patch, generated component, route, story, or visual diff with enough context to identify changed user flows.
Access to the project's accessibility target, component library conventions, design tokens, browser test command, and review environment.
A local, preview, or staging URL where keyboard checks and automated accessibility scans can run without touching production data.
Permission to block merge when generated UI removes accessibility semantics or when verification evidence is incomplete.
A pull request or diff that adds or edits event types, handlers, projections, aggregates, snapshots, or event-store queries in an event-sourced system.
Knowledge of the event store and framework in use, since stream naming, optimistic concurrency, and replay semantics differ between implementations.
Access to a test environment where event replay, schema evolution, and snapshot consistency can be exercised without corrupting the production event log.
Permission to block merge when an event schema change breaks existing projections, a handler is not idempotent, or aggregate state diverges between load paths.
A migration pull request, SQL patch, ORM migration, release plan, or generated schema diff that may run against a shared or production database.
Access to the target database engine documentation, migration tool behavior, current CI status, staging or dry-run result, and affected service owner.
A documented deployment order for application code, background jobs, migrations, backfills, cleanup migrations, and rollback or forward-fix steps.
Permission to block merge when the migration risk, owner review, test evidence, or privacy handling is incomplete.