Open brianjor opened 5 months ago
I can fix this depending on what the actual expectations are.
Leave .index
incase someone decides to use an http verb in their route itself, causing a collision on .get()
or whatever the verb was, or do we strip index and assume people wont be using http verbs in their routes?
eden.hello.index.get()
should return data.eden.hello.index.get()
should show a type error and eden.hello.get()
should return data.I am expecting eden.hello.get()
to return data, as it was pre 1.0. It still does, as shown in the example, it's just the warning is blocking CI/CD checks preventing me from updating.
I would prefer not to have to add .index
to the api calls.
Also this only seems to be an issue with routes behind group
.
See:
import { edenTreaty } from "@elysiajs/eden";
import Elysia from "elysia";
const helloHandlers = new Elysia().get("", () => "hello");
const routes = new Elysia()
.get("/goodbye", () => "bye")
.group("/hello", (_) => _.use(helloHandlers));
const app = new Elysia().use(routes).listen(3000);
const eden = edenTreaty<typeof app>("localhost:3000");
console.log((await eden.hello.get()).data); // <-- has red squiggly, but works!
console.log((await eden.hello.index.get()).data); // <-- no red squiggly, "NOT_FOUND"
console.log((await eden.goodbye.get()).data); // <-- no squiggly, working as expected
app.stop();
"@elysiajs/eden": "1.0.5", "elysia": "1.0.7"
index.ts:
output from running:
Error message: