Skip to content

Import checking breaks when "references" is set in tsconfig. All unchecked: import collision, missing imports, unused imports #38605

@SephReed

Description

@SephReed

TypeScript Version: (No version check command supplied)

Search Terms:
reference unused import

Code

// @ ./common/index.ts
export const foo = "bar";
export const baz = "qux";
// @ ./project/tsconfig.json
{
  "compilerOptions": {
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "common": ["../common/"]
    },
    "esModuleInterop": true
  }
}
// @ ./project/src/tscofig.json.ts
{
   "references": [
      { "path": "../" }
   ],
  "compilerOptions": {
    "rootDir": ".",
    "outDir": "../dist",
    "composite": true,
   },
 }
// @ ./project/src/world.ts
export const hello = "world";
// @ ./project/src/index.ts

// baz and hello should be unused imports
import { foo } from "common";
import { baz } from "common";
import { hello } from "./world"

console.log(foo);

// this function doesn't exist
thisShouldBeBroken();

Expected behavior:
Missing/unused imports feature should be recognized whether or not "references" is used in tsconfig.

Actual behavior:
Missing/unused imports feature only works without "references" set

Features broken:
Screen Shot 2020-05-15 at 11 04 27 PM

Remove "references"
Screen Shot 2020-05-15 at 10 50 57 PM

Features work again:
Screen Shot 2020-05-15 at 11 04 38 PM

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions