Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error occurs in a simple example code #1035

Open
combab0 opened this issue Jan 26, 2025 · 1 comment
Open

Type error occurs in a simple example code #1035

combab0 opened this issue Jan 26, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@combab0
Copy link

combab0 commented Jan 26, 2025

What version of Elysia is running?

"@elysiajs/eden": "^1.2.0", "elysia": "^1.2.10"

What platform is your computer?

NA

What steps can reproduce the bug?

import { treaty } from '@elysiajs/eden'
import swagger from '@elysiajs/swagger'
import Elysia from 'elysia'

const app = new Elysia({ prefix: '/api' })
  .use(swagger())
  .get('/', () => 'Hello World')
  .listen(3000)

type App = typeof app

treaty<App>('http://localhost:3000')

Image

The use and treaty functions do not have proper type overloading.

What is the expected behavior?

no type error.

What do you see instead?

type error.

Additional information

I’d love to contribute directly, but my TypeScript skills are lacking. I hope it gets fixed.

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

No response

@combab0 combab0 added the bug Something isn't working label Jan 26, 2025
@hisamafahri
Copy link
Contributor

I believe it's a version mismatch. Try to make sure those three packages (elysia, @elysiajs/swagger, @elysiajs/eden) to match.

Here's the latest version that should work (don't forget to remove node_modules and bun.lockb first:

 "@elysiajs/eden": "^1.2.0",
 "@elysiajs/swagger": "^1.2.0",
"elysia": "^1.2.10"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants