Skip to content

chore: enhance type to keep reference to its T - #259

Merged
ndisidore merged 1 commit into
cloudflare:mainfrom
yusuke99:fix/issue-258
Aug 28, 2026
Merged

chore: enhance type to keep reference to its T#259
ndisidore merged 1 commit into
cloudflare:mainfrom
yusuke99:fix/issue-258

Conversation

@yusuke99

Copy link
Copy Markdown
Contributor

Closes #258

When creating a stub type from a server class T, it drop keys such as brand symbols. Currently it iterates with Exclude<keyof T, …>, which makes TypeScript then treats the result as a new object, so "Go to Definition" on api.authenticate() no longer jumps to T.authenticate. This PR still drops the same keys, but maps over keyof T first and then Pick.

Here is a minimal PoC difference between using Exclude<keyof T, …> vs using Pick:

https://www.typescriptlang.org/play/?#code/MYGwhgzhAEDKYFsAOICm0DeAoa0BmA9gQBQCUmOu0ATqgC4Cu1AdtHdQ6gNyUC+lAIzDUyFKjXpNW7Tj1z9+WOgE8k6AIIAeACoA+aAF4x0ANoBpaAEtWAUQAeoBgBNUmgNaplBPNG0AaaAByIWpA3QBdAC5fc3CeXh4lVXQAIR19IwAFS2A3TUpscXMrVg8vH20omLM4vj9Ke0cXd09vXwDg4TCsXUSXUGF0YAJmCDpoMGiteGQ0Xqx+8FpoYdHxgWi0mZRUeawwADpCElIeAHoz6AA9AH4sASOiMnPL26wsIA

capnweb.mp4

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 19c2bf4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@yusuke99

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 28, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/capnweb@259
npm i https://pkg.pr.new/cloudflare/capnweb/capnweb-validate@259

commit: 19c2bf4

@ndisidore ndisidore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the DevEx wins and the included video! That's how you do a PR right there.
Looks good, just getting a few others on the team to take a look

@ndisidore
ndisidore merged commit 3f34bfd into cloudflare:main Aug 28, 2026
7 of 8 checks passed
@yusuke99
yusuke99 deleted the fix/issue-258 branch August 28, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot "Go to Definition"

2 participants