-
-
Notifications
You must be signed in to change notification settings - Fork 366
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.1.12
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
Type check the code below.
import { edenFetch, edenTreaty, treaty } from "@elysiajs/eden";
import Elysia from "elysia";
const app = new Elysia().get("/:id", () => null);
type App = typeof app;
const edenClient = treaty<App>("http://localhost:3000");
// ^? {}
// This doesn't work:
edenClient({ id: "1" }).get(); // This expression is not callable. Type '{}' has no call signatures.
const fetch = edenFetch<App>("http://localhost:3000");
fetch("/:id", { params: { id: "1" } }); // Works
const edenTreaty1Client = edenTreaty<App>("http://localhost:3000");
edenTreaty1Client[":id"].get(); // Works
What is the expected behavior?
edenClient
should support /:id
by edenClient({ id: "1" })
.
What do you see instead?
Both edenFetch
and the old edenTreaty
have awesome support for /:id
, but the new treaty doesn't. edenClient
simply doesn't register the route /:id
at all, and since there are no other routes here, the type of edenClient
is {}
and running ({ id: "1" })
on it doesn't work.
Additional information
N/A
Have you try removing the node_modules
and bun.lockb
and try again yet?
Yes
Pranavtechie, nsarrazin and askareija
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working