Repository navigation
fix(realtime): annotate Timer/Vsn getters to avoid deep phoenix imports - #2281
Merged
Merged
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
filipecabaco
previously approved these changes
Apr 27, 2026
filipecabaco
approved these changes
Apr 27, 2026
This was referenced May 11, 2026
This was referenced May 13, 2026
This was referenced May 13, 2026
This was referenced May 14, 2026
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes type-checking failures for consumers using
moduleResolution: NodeNext. The published.d.tsfiles in@supabase/realtime-jswere inlining inferred return types viaimport("@supabase/phoenix/priv/static/types/timer")andimport("@supabase/phoenix/priv/static/types/types").@supabase/[email protected]'sexportsmap only publishes the root entry, so those deep paths fail to resolve and produceTS2307errors unless consumers enableskipLibCheck.What changed?
packages/core/realtime-js/src/RealtimeChannel.ts: addedimport type { Timer } from './phoenix/types'and annotatedget rejoinTimer(): Timer.packages/core/realtime-js/src/RealtimeClient.ts: addedTimerandVsnto the existing type-only import from./phoenix/typesand annotatedget reconnectTimer(): Timerandget vsn(): Vsn.TimerandVsnare already re-exported fromsrc/phoenix/types.ts, originating from the public root entry of@supabase/phoenix. With explicit annotations on the three getters, TypeScript's declaration emit references those names directly instead of falling back toimport("...")against the original phoenix internal files.Why was this change needed?
Without explicit return type annotations, TypeScript's declaration emit inferred the types and inlined them via
import()pointing at the original definitions insidenode_modules/@supabase/phoenix/priv/static/types/. Phoenix'sexportsmap blocks resolution of those deep paths underNodeNext, so consumers got:Verified against the published
@supabase/[email protected]tarball that the three offending lines were:dist/module/RealtimeChannel.d.ts:169→get rejoinTimer(): import("@supabase/phoenix/priv/static/types/timer").default;dist/module/RealtimeClient.d.ts:76→get reconnectTimer(): import("@supabase/phoenix/priv/static/types/timer").default;dist/module/RealtimeClient.d.ts:77→get vsn(): import("@supabase/phoenix/priv/static/types/types").Vsn;After this fix,
nx build realtime-jsemitsget rejoinTimer(): Timer;,get reconnectTimer(): Timer;, andget vsn(): Vsn;instead. Agrepforphoenix/priv/staticacrossdist/returns zero matches.This keeps phoenix's internal file layout private (preferred fix from the issue) rather than exposing it through phoenix's
exportsmap.Closes #2276
Screenshots/Examples
N/A. The change is in TypeScript declaration emit only.
Breaking changes
The runtime behavior is unchanged. The only effect is on the emitted
.d.ts: the public return types (Timer,Vsn) are equivalent to what was previously inferred, just referenced via the public re-export rather than a deep path.Checklist
<type>(<scope>): <description>npx nx formatto ensure consistent code formattingNo new tests added: the fix is a pure type annotation change with no runtime behavior to test, and the existing 333 unit tests pass unchanged via
nx test realtime-js. A regression test that greps the built.d.tsforphoenix/priv/staticpaths could be added as a follow-up if desired.Additional notes
The reporter on #2276 also offered an alternative fix in
@supabase/phoenix(publish subpath exports for./priv/static/types/*). That alternative would unblock type-checking but bake phoenix's internal file layout into realtime-js's public contract. The annotation fix here is preferred and self-contained in this repo.