elysiajs / eden

Fully type-safe Elysia client
MIT License
136 stars 38 forks source link

Issue with TypeScript Path Alias in eden Treaty Mapping #99

Open Jojit-Thomas opened 1 month ago

Jojit-Thomas commented 1 month ago

The eden treaty fails to map the API correctly when using TypeScript path aliases. It only works with relative paths.

Steps to Reproduce Set up a TypeScript project with path aliases configured in tsconfig.json. Attempt to use a path alias in the eden treaty configuration. For example, use @/authRouter instead of ./authRouter.

// This works import authRouter from './authRouter';

// This doesn't work import authRouter from '@/authRouter';

Environment eden version: 1.0.11 TypeScript version: 5.4.5 Bun version: 1.1.10 OS: Mac OS

abielzulio commented 2 weeks ago

Facing the same issue here

Ripwords commented 2 weeks ago

Here's the fix, https://github.com/elysiajs/eden/issues/110#issuecomment-2211609516

You just need your frontend's tsconfig to reference the backend's tsconfig