Closed
Description
I assume this is unintentional because:
- Bun seems to serve the routes and websocket just fine when they're both defined (as well as the fetch for the upgrade and other non-websocket routes)
- the
static
property thatroutes
is replacing works fine alongsidewebsocket
Example of what I'm trying to do:
import index from "./index.html";
import { Elysia } from "elysia";
const app = new Elysia(); // ...
Bun.serve({
routes: { "/": index }, // ERROR in typescript
// static: { "/": index }, // typescript is happy with this (though it's deprecated)
fetch: (req, server) => {
if (!server.upgrade(req)) {
return app.handle(req);
}
},
websocket: {
message: (ws, message) => { /* ... */ },
},
});
Relevant Bun code:
bun/packages/bun-types/bun.d.ts
Lines 4495 to 4512 in 078318f
bun/packages/bun-types/bun.d.ts
Lines 4107 to 4124 in 078318f