cloudflare / cloudflare/workers-sdk

🐛 BUG: missing dispose on RPC Stub promise type

Open
#8,566 2 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
186

Description

### Which Cloudflare product(s) does this pertain to?

Workers Runtime

### What versions are you using?

⛅️ wrangler 4.1.0

### What operating system and version are you using?

macOS 15.3.2

### Please provide a link to a minimal reproduction

https://github.com/xlc/using-issue

### Describe the Bug

The stub type (`result2`) should confirm to Disposable interface but it is not

```ts
// not working
using result2 = worker.foo()
using m2 = result2.method()
const n2 = await m2.nested()
```

### Please provide any relevant error logs

```
src/index.ts:32:19 - error TS2850: The initializer of a 'using' declaration must be either an object with a '[Symbol.dispose]()' method, or be 'null' or 'undefined'.

32 using result2 = worker.foo()
~~~~~~~~~~~~

src/index.ts:33:14 - error TS2850: The initializer of a 'using' declaration must be either an object with a '[Symbol.dispose]()' method, or be 'null' or 'undefined'.

33 using m2 = result2.method()
~~~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: src/index.ts:32
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.