-
-
Notifications
You must be signed in to change notification settings - Fork 412
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
What platform is your computer?
MacOS Sequoia 15.6.1
What environment are you using
1.2.22
Are you using dynamic mode?
No
What steps can reproduce the bug?
import { Elysia } from "elysia";
export const myPlugin = new Elysia({ name: "myPlugin" }).derive(
{ as: "scoped" },
async ({ set, status }) => {
return {
name: "Brent",
};
}
);
const app = new Elysia()
.use(myPlugin)
.get("/", ({ name }) => "Hello Elysia", {
// ✅ Works: derived context is available
beforeHandle: ({ name }) => {
console.log(name);
},
})
.post("/", ({ name }) => "Hello Elysia", {
// ✅ Works: derived context is available
beforeHandle: ({ name }) => {
console.log(name);
},
})
.delete("/", ({ name }) => "Hello Elysia", {
// ❌ Fails: derived context is NOT available
beforeHandle: ({ name }) => {
console.log(name); // TypeScript error here
},
})
.listen(3000);
What is the expected behavior?
The name property should be available and properly typed in beforeHandle for all HTTP methods, including .delete().
What do you see instead?
TypeScript error on the .delete() route's beforeHandle: Property 'name' does not exist on type '{ body: unknown; query: Record<string, string>; params: {}; headers: Record<string, string | undefined>; cookie: Record<string, Cookie>; server: Server | null; ... }'
Additional information
- The issue is specific to the .delete() method - other HTTP verbs work correctly
- The main route handler ({ name }) => "Hello Elysia" works fine for all methods
- Only the beforeHandle context typing is affected for .delete()
- This appears to be a TypeScript definition issue rather than a runtime problem
Have you try removing the node_modules and bun.lockb and try again yet?
Yes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working