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

Elysia fails to generate types when used with path aliases #887

Open
Pedromigacz opened this issue Oct 21, 2024 · 6 comments
Open

Elysia fails to generate types when used with path aliases #887

Pedromigacz opened this issue Oct 21, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Pedromigacz
Copy link

What version of Elysia is running?

elysia": "^1.1.22

What platform is your computer?

No response

What steps can reproduce the bug?

  1. Qucikstart an ElysiaJs project with bun create elysia app
  2. Add an import alias to your tsconfig.json. Ex:
"paths": { "@/*": ["./*"] }
  1. Use this import alias anywhere on your code to import a ElysiaJs instance. The most obvious issue happens when you import an ElysiaJs instance that is used for route splitting.
  2. Your elysia main instace won't have the types of the other ones. This makes eden unusable as a side effect.

What is the expected behavior?

ElysiaJs should know how to handle with import aliases. Independent of them being on a monorepo or not.

What do you see instead?

Elysia type system breaks

Additional information

This might be happening on monorepos only. I will investigate once I find time and report back.

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

Yes

@Pedromigacz
Copy link
Author

Pedromigacz commented Oct 21, 2024

I created this issue and this PR to warn users about this issue until I or someone figure out how to solve it.

@kravetsone
Copy link
Contributor

They shouldn't break nothing.
Does typings equal?

@Pedromigacz
Copy link
Author

I will provide a easy way to reproduce the issue. Do you know, in the meantime, where can I find the generated types from elysia/eden?

@kravetsone
Copy link
Contributor

I will provide a easy way to reproduce the issue. Do you know, in the meantime, where can I find the generated types from elysia/eden?

It is not generated
Elysia is just TypeScript

@ap0nia
Copy link

ap0nia commented Oct 24, 2024

You can use the references property in tsconfig.json to include the tsconfig from the backend in the frontend.

This is not an Elysia issue, this is a TypeScript configuration issue.

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

4 participants
@kravetsone @Pedromigacz @ap0nia and others