Repository navigation
feat: export the contract types for the substitution path - #179
Merged
Merged
Conversation
An app that swapped socket.io-client for smocket got the value side of the substitution and lost the type side: `io(url)` resolved, but there was no name to annotate the result with, since the only exported types were configuration ones. So the swap preserved behaviour and dropped types. The five entry points reach nine more through their own members, and those names already appear in the emitted declarations, so they are exported rather than left reachable but unnameable. `ConnectedClient` and `ServerContext` stay unexported, being the dual-run test setup's shape and not an app-facing surface. Whether any of these is also aliased to socket.io's own `Socket` name is left open. One package cannot give that name to both the server and the client socket, and supporting both directions needs subpath exports. Refs #178
📝 WalkthroughWalkthroughChangesPublic contract exports
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
electrohyun
marked this pull request as draft
August 7, 2026 08:27
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/index.test.ts`:
- Around line 49-52: In the connection setup around Server.nextConnection and
io, create and store the nextConnection() promise before invoking
io('http://localhost'), then await that stored promise for serverSocket.
Preserve the existing server and client contract assignments.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 27df4b29-11fb-49e2-bd59-b1f0dc5c9891
📒 Files selected for processing (2)
src/index.test.tssrc/index.ts
electrohyun
marked this pull request as ready for review
August 7, 2026 08:29
2 tasks done
2 tasks done
1 of 3 tasks
This was referenced Aug 13, 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.
Summary
An app that swaps
socket.io-clientfor smocket viaresolve.aliasorvi.mockgotthe value side of the substitution and lost the type side.
io(url)resolved, butsrc/index.tsexported only configuration types, so there was no name to annotate theresult with. This is stage 1 of #178 and stands on its own, independent of #171.
ServerContract,ServerSocketContract,ClientSocketContract,NamespaceContract,and
Handshakeare now exported. They reach nine more types through their own members(
BroadcastContract,TimeoutBroadcastContract,TimeoutEmitterContract,SocketTimeoutContract,VolatileServerSocket,VolatileClientSocket,AdapterContract,ConnectionMiddleware,MiddlewareError), which already appear inthe emitted declarations, so those are exported too rather than left reachable but
unnameable.
ConnectedClientandServerContextstay unexported, being the dual-runtest setup's shape rather than an app-facing surface.
Additive, with no change to the
exportsmap, so existing call sites keep compiling.That is category 7 under 0019, a minor. Stage 2 of #178, the
Socketname and subpathexports, is not here: one package cannot give that name to both the server and the
client socket, and the design question comes first.
The new test annotates every exported type the way an app would. The annotations are
the assertion, since a missing export stops
pnpm typecheckcompiling.Related issue
Refs #178
Checklist