mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix(types): Socket.reload() now correctly expects { socket: handler } (#26291)
## Summary
- Fix type definition for `Socket.reload()` to match runtime behavior
- The runtime expects `{ socket: handler }` but types previously
accepted just `handler`
## Test plan
- [x] Added regression test `test/regression/issue/26290.test.ts`
- [x] Verified test passes with `bun bd test`
Fixes #26290
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Alistair Smith <hi@alistair.sh>
This commit is contained in:
@@ -145,3 +145,23 @@ listener.reload({
|
||||
// ...listener.
|
||||
},
|
||||
});
|
||||
|
||||
// Test Socket.reload() type signature (issue #26290)
|
||||
// The socket instance's reload() method should also accept { socket: handler }
|
||||
await Bun.connect({
|
||||
data: { arg: "asdf" },
|
||||
socket: {
|
||||
open(socket) {
|
||||
// Socket.reload() should accept { socket: handler }, not handler directly
|
||||
socket.reload({
|
||||
socket: {
|
||||
open() {},
|
||||
data() {},
|
||||
},
|
||||
});
|
||||
},
|
||||
data() {},
|
||||
},
|
||||
hostname: "localhost",
|
||||
port: 1,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user