Skip to content

"Inferred type cannot be named" error caused by adding paths to tsconfigΒ #57802

Closed
@haines

Description

@haines

πŸ”Ž Search Terms

"inferred type cannot be named", "paths"

πŸ•— Version & Regression Information

⏯ Playground Link

https://github.com/haines/typescript-paths-inferred-type-cannot-be-named

πŸ’» Code

Please see the linked repo (sorry, I couldn't reduce it any further).

πŸ™ Actual behavior

In a multiproject build where app depends on lib, setting paths in lib's tsconfig breaks app's build with

error TS2742: The inferred type of '...' cannot be named without a reference to '...'. This is likely not portable. A type annotation is necessary.

πŸ™‚ Expected behavior

Adding paths shouldn't break the dependent project.

Additional information about the issue

Judging by the PR that I was able to bisect to, this seems like it could a bad interaction between paths in tsconfig.json and exports in package.json.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions