Replies: 5 comments 1 reply
-
Hi, I am battling with monorepo and TS as well.
|
Beta Was this translation helpful? Give feedback.
-
If I understand the problem correctly. I sometimes fix this issue by making sure to also manually import the type in the file to help TypeScript a hand |
Beta Was this translation helpful? Give feedback.
-
I had something similar. But it was because of peer dependency of one of my lib was declared as |
Beta Was this translation helpful? Give feedback.
-
My current solution is to hoist the
The steps needed to make it works:
After these steps, everything is working. |
Beta Was this translation helpful? Give feedback.
-
Typically, this class of error: |
Beta Was this translation helpful? Give feedback.
-
Hello all 👋,
I'm trying to setup a monorepo based on pnpm, TypeScript and I have issues with hoisting.
The best practice is to not hoist so I want to avoid node-linker so my packages are all nicely isolated. However, I'm hitting this TypeScript error as soon as I share types between my packages:
This is quite a recurring issue for pnpm and TypeScript users.
I can partially solve it by adding the external packages in error to
public-hoist-pattern[]
, however I need to manually delete the symlink in the local packages (for examplemy-project/packages/foo/node_modules/@trpc/server
is still created even if@trpc/server
was added topublic-hoist-pattern[]
and is now present inmy-project/node_modules/@trpc/server
). Is that normal? Can it be avoided with pnpm options?This is only half of the issue. The other part is about internal packages which share types. In this case, we can't use
public-hoist-pattern[]
on them, so I find no "proper" way of solving this for this use case. Could we havepublic-hoist-pattern[]
working with internal packages? I think right now the only solution would be to install them in the root, but that's just wrong. 😅It seems a legitimate use case for supporting this: #3642
Beta Was this translation helpful? Give feedback.
All reactions