From d705eb3e4f80effb9fcf93c9f936e6af165e3aec Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 9 Jun 2026 22:02:09 -0500 Subject: [PATCH] docs(shared): reframe the apiUrlFromPublishableKey return type rationale --- .changeset/apiurl-return-type-rationale.md | 2 ++ packages/shared/src/apiUrlFromPublishableKey.ts | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/apiurl-return-type-rationale.md diff --git a/.changeset/apiurl-return-type-rationale.md b/.changeset/apiurl-return-type-rationale.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/apiurl-return-type-rationale.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/shared/src/apiUrlFromPublishableKey.ts b/packages/shared/src/apiUrlFromPublishableKey.ts index 3f1e8a7339b..dca8b42ca00 100644 --- a/packages/shared/src/apiUrlFromPublishableKey.ts +++ b/packages/shared/src/apiUrlFromPublishableKey.ts @@ -8,11 +8,11 @@ import { } from './constants'; import { parsePublishableKey } from './keys'; -// The return type is annotated explicitly so the declaration emit stays -// deterministic. An inferred union's member order comes from TypeScript's -// global type-id assignment, which shifts as unrelated code changes and made -// break-check report phantom diffs for this export. These literals mirror the -// *_API_URL constants returned below; tsc errors here if a value ever drifts. +// Explicit return type per the repo TypeScript guideline for public APIs, +// written as literals because `typeof CONST` would pull a hashed `_chunks/*` +// import into the published d.ts. The literals mirror the *_API_URL constants +// returned below (tsc errors here if a value drifts), and the pinned order +// keeps the declaration emit deterministic where inference is not. /** * Get the correct API url based on the publishable key. *