Skip to content

Package dependencies and The inferred type of ... cannot be named without a reference to ... #29808

Closed as not planned
@AnyhowStep

Description

@AnyhowStep

TypeScript Version: 3.3.0-dev.20190119

Search Terms: inferred type, cannot be named, reference, package, dependency

This isn't really a traditional bug report. Mostly a PSA of some sort.

Code

The dependencies of interest are,

  • My project has a direct dependency to "A"
  • My project has a direct dependency to "B"
  • "A" has a direct dependency to "B"

Before updating,

  • My project has 1.0.0 of package "A" (older version)
  • My project has 2.51.1 of package "B" (older version)
  • 1.0.0 of package "A" has 2.51.1 of package "B" (older version)

After updating package "A",

  • My project has 1.0.1 of package "A" (newer patch version, bug-fix, no .d.ts changes)
  • My project has 2.51.1 of package "B" (older version)
  • 1.0.1 of package "A" has 2.51.2 of package "B" (newer patch version, bug-fix, no .d.ts changes)

There's a package version mismatch here.
My project has 2.51.1 of "B" but the package I updated has 2.51.2 of "B".


In the newer version of "A" and "B", no .d.ts files were added/removed/modified.


Expected

Before updating, the project compiled.
So, the rationale is that after updating a patch version, the project should still compile.

Actual

After updating, the project stopped compiling.

tsc crashed; out-of-memory exception.

VS Code gave me the error,

The inferred type of ... cannot be named without a reference to node_modules/A/node_modules/B


Workaround

The workaround is to just update "B" to 2.51.2 in my project. After doing so, everything compiles again.

It seems like package versions matter to TypeScript when it comes to transitive dependencies. Even if it's a patch version and no .d.ts files are added/removed/modified.

Related Issues: #29221

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions