Re: relative imports to trpc.ts
For reference: https://github.com/trpc/trpc/pull/6112
@Nick Lucas
Let's assume for a second it were the case that it's something wrong with the setup.
How comes the type inference of
Is there any known project that uses different packages and path alias imports and still works that you could guide me to?
@Nick Lucas
Let's assume for a second it were the case that it's something wrong with the setup.
How comes the type inference of
type AppRouter = typeof appRouter on the server side works as expected, regardless of relative / path alias import. But only upon client side import, the type isn't inferred properly anymore?Is there any known project that uses different packages and path alias imports and still works that you could guide me to?
GitHub
Checklist
I have followed the steps listed in the Contributing guide.
If necessary, I have added documentation related to the changes made.
I have added or updated the tests related to the ch...
I have followed the steps listed in the Contributing guide.
If necessary, I have added documentation related to the changes made.
I have added or updated the tests related to the ch...
Solution
I finally discovered the root cause.
It's a typescript issue. By implication you can call this a setup issue. I stay humbled @Nick Lucas
Basically, using tsconfig
The server/user.router.ts will use the client/tsconfig.json#paths for module resolution during the import from client/index.ts (in contrast to imports from within server/).
So, having a single
I'll update the PR and improve the description in FAQ/Troubleshooting. Sorry for the tumult.
It's a typescript issue. By implication you can call this a setup issue. I stay humbled @Nick Lucas
Basically, using tsconfig
paths within the child packages in monorepos is a bad idea :/The server/user.router.ts will use the client/tsconfig.json#paths for module resolution during the import from client/index.ts (in contrast to imports from within server/).
So, having a single
@/ alias for the src/ dir of the current package seems impossible (unless you risk a merged type alias).I'll update the PR and improve the description in FAQ/Troubleshooting. Sorry for the tumult.