In my Turborepo monorepo, I have a Next.js app package that imports various components from a shared package. This shared package is not compiled; it simply contains components imported directly by apps in the monorepo.
The issue arises with the shared components' imports such as:
import Link from 'next/link'
TypeScript triggers an error because it cannot locate packages like next/link
within the shared components package (which does not include node_modules). Additionally, using pnpm means most external npm packages are only accessible to the specific package that uses them and are not hoisted to the root of the monorepo.
Is there a viable solution to instruct TypeScript not to generate an error for these scenarios, essentially treating them as peerDeps?