Skip to content

Conversation

@dimitropoulos
Copy link
Contributor

@dimitropoulos dimitropoulos commented Dec 31, 2025

I happened to notice there's a few errors in index.test.ts. Seems like that's because the build skips the tests (naturally) and vitest doesn't do typechecking.

here's the error:

Argument of type '(i: number) => Promise<number>' is not assignable to parameter of type 'Unstubify<((i: Unstubify<number>) => Promise<number> & { toString: (radix?: Unstubify<number | undefined>) => Promise<string> & { [x: number]: Promise<...> & ... 2 more ... & StubBase<...>; ... 50 more ...; toWellFormed: () => Promise<...> & ... 2 more ... & StubBase<...>; } & { ...; } & StubBase<...>; ... 4 more .....'.
  Type '(i: number) => Promise<number>' is not assignable to type '(i: number) => number'.
    Type 'Promise<number>' is not assignable to type 'number'.ts(2345)
image

Copilot AI review requested due to automatic review settings December 31, 2025 19:59
@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

⚠️ No Changeset found

Latest commit: f15b1f3

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
Copy link
Contributor

github-actions bot commented Dec 31, 2025

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a TypeScript type assignability error in the test suite and corrects a spelling mistake. The build process skips tests and vitest doesn't perform typechecking by default, which allowed these issues to go undetected.

  • Updated the type signature of callFunction to correctly accept async functions returning Promise<number> instead of synchronous functions
  • Corrected spelling typo in test description

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
__tests__/test-util.ts Fixed type signature of callFunction method to accept RpcStub<(i: number) => Promise<number>> instead of RpcStub<(i: number) => number>, resolving TypeScript assignability error
__tests__/index.test.ts Corrected spelling of "functinos" to "functions" in test case description

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dimitropoulos
Copy link
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 Dec 31, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/capnweb@124

commit: f15b1f3

@kentonv
Copy link
Member

kentonv commented Jan 5, 2026

Thanks!

FWIW, I think there are also a couple places in the test where TypeScript complains about infinite recursion, which seems like a deeper problem with the way the types work right now that needs to be addressed.

types.d.ts actually originates as a copy of workerd's rpc.d.ts, but with several refinements (that should probably be backported to workerd at some point). However, it is still a bit janky. Could definitely use some help from a TypeScript expert to get this all working properly!

@kentonv kentonv merged commit 34ce42c into cloudflare:main Jan 5, 2026
10 of 11 checks passed
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.

2 participants