elysiajs / eden

Fully type-safe Elysia client
MIT License
173 stars 41 forks source link

Including a "/" makes an index path that does not work #153

Open Renato66 opened 1 month ago

Renato66 commented 1 month ago

What version of Elysia is running?

1.1.20

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

for more details: https://github.com/Renato66/elysia-error

with this app:

const app = new Elysia().use(
  cors({
    origin: 'localhost:5173',
  })
  .group('/api', (app) => app
    .group('/company', (app) => app
      .get("/", () => {
        return {
          items: [{id: 1, name: "with slash"}],
          total: 1
        }
      })
    )
  )  
).listen(3000)

will work, but will have typescript errors

const response = await eden.api.company.get()

will not work, but will have all types

const response = await eden.api.company.index.get()

What is the expected behavior?

types from api.company.get() will return api.company.index.get()

What do you see instead?

No response

Additional information

If using group and use functions, like in the repo as example, it will always return as an index in the types

Have you try removing the node_modules and bun.lockb and try again yet?

No response