Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeScript fails to find declaration file of a peer project after it rebuilds in a monorepo #61610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anthonyma94 opened this issue Apr 23, 2025 · 0 comments
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@anthonyma94
Copy link

πŸ”Ž Search Terms

monorepo, ts7016, build, peer, project builds

πŸ•— Version & Regression Information

  • TypeScript v5.7.3

⏯ Playground Link

No response

πŸ’» Code

packages/sandbox/index.ts (app)

import { createLogger } from "@dmca/utils/logger";

(async function () {
    const [logger] = createLogger(undefined, "local");

    console.log("done.");
})();

packages/sandbox/package.json

{
  "name": "@dmca/sandbox",
  "dependencies": {
    "@dmca/utils": "workspace:^"
  }
}

libs/utils/package.json (library)

{
  "name": "@dmca/utils",
  "exports": {
    "./logger": {
      "types": "./dist/logger/index.d.ts",
      "default": "./dist/logger/index.js"
    },
  }
}

libs/utils/src/logger/index.ts

export const createLogger = () => {
  ...
}
...

πŸ™ Actual behavior

index.ts.-.dmca-aws.Dev.Container_.DMCA.AWS.@.code-server.-.Visual.Studio.Code.2025-04-23.15-30-32.mp4

I'm using a monorepo via pnpm workspaces with TypeScript 5.7.3. Libraries have an exports field in package.json that point to a compiled version of it. Whenever I recompile the library, all references to it fails with the error Could not find a declaration file for module "@module". path-to-compiled-js implicitly has an any type., until I either restart tsserver or delete and re-add the reference. The video shows the error process.

πŸ™‚ Expected behavior

I expect tsserver not to fail.

Additional information about the issue

No response

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Apr 24, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

2 participants