fix: Use TypeScript private keyword instead of ES #private fields#127
Merged
benbrandt merged 3 commits intoagentclientprotocol:mainfrom Apr 21, 2026
Merged
Conversation
… in exported classes ES private fields (`#field`) are included in `.d.ts` declarations and use nominal identity, which causes type incompatibilities when multiple copies of the package exist in a monorepo (e.g. pnpm installs). Switching to TypeScript's `private` keyword keeps these fields out of the declarations entirely, fixing the issue. Fixes agentclientprotocol#126 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… keyword For consistency with the exported classes, also converts the internal Connection class from ES #private fields/methods to TypeScript private. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
I think we only need to change the private members and not the methods if I understand the symptom correctly? These are the only export declare class AgentSideConnection {
#private;
export declare class TerminalHandle {
#private;
export declare class ClientSideConnection implements Agent {
#private;
declare class Connection {
#private; |
Contributor
Author
I was thinking we should go for consistency throughout, but agree we can just change the public interface. If you feel strongly about it I'll back out the changes to the internals |
benbrandt
approved these changes
Apr 21, 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
#privatefields with TypeScript'sprivatekeyword in all classes:AgentSideConnection,ClientSideConnection,TerminalHandle, and the internalConnectionclass#privatefields appear in.d.tsdeclarations and use nominal identity, causing type mismatches when multiple copies of the package exist (common in pnpm monorepos)privatekeyword keeps these fields out of the declarations entirely, fixing the issueFixes #126
Test plan
tscbuilds successfully with no type errors.d.tsoutput no longer contains#privatefor exported classes🤖 Generated with Claude Code