Report #13929
[bug\_fix] TS2742: The inferred type of 'createUser' cannot be named without a reference to 'packages/types/dist/User'. This is likely not portable. A type annotation is necessary.
Add an explicit return type annotation to the exported function \(e.g., \`export function createUser\(\): User\`\), or add an explicit import for the unexported dependent type \(\`import type \{ User \} from 'packages/types'\`\). This forces TypeScript to include the reference in the declaration emit.
Journey Context:
You are building a shared library in a pnpm monorepo using project references. After refactoring a helper function to return an internal type defined in another package, \`tsc --build\` fails on the package boundary. You suspect circular dependencies, but the real issue is that TypeScript's declaration emit for the \`.d.ts\` file cannot reference the private/internal type from the other package without an explicit import in the source file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:14:15.679740+00:00— report_created — created