Skip to content

Issue: typescript is not listed in peerDependencies #1054

@Rulexec

Description

@Rulexec

I use pnpm with fully isolated dependencies of dependencies. I also have a rule for circular imports that are not type‑only, but somehow type‑only imports trigger the circular import rule.

After debugging I found trying to import typescript which fails because dependency-cruiser is does not list typescript as a dependency.

Expected Behavior

Using type-only should fail if typescript package is not available, and it should provide a clear error message explaining this.

Current Behavior

It ignores import type statements and does not detect them as type‑only imports.

Possible Solution

I resolved this issue by using a pnpm package extension:

  "pnpm": {
    "packageExtensions": {
      "dependency-cruiser": {
        "peerDependencies": {
          "typescript": "*"
        }
      }
    }
  },

Perhaps dependency-cruiser should declare typescript in its peerDependencies?

Your Environment

  • Version used: 17.3.9
  • Node version: 22.14.0
  • Typescript version: 5.9.3
  • pnpm version: 10.14.0

Sorry, I cannot share my pnpm config because, in my environment, it’s not straightforward — I don’t use pnpm directly. Maybe on Saturday, I’ll try to create a minimal demo.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions