pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project
MIT License
749 stars 49 forks source link

Dynamic import detection producing false positives #117

Closed jp7837 closed 4 years ago

jp7837 commented 4 years ago

a.ts:

export const A = 1;
export const A_unused = 2;

b:ts:

import("./a").then(A_imported => {
  console.log(A_imported.A);
});
export const B_unused = 0;

tsconfig.json:

{
    "compilerOptions": {
        "lib": ["ES2015", "DOM"]
    },
    "files": [
        "a.ts",
        "b.ts"
    ]
}

Expected: A_unused, B_unused marked as unused Actual: A, A_unused, B_unused marked as unused.

A should not be marked as unused since it's referenced in B.

jp7837 commented 4 years ago

Thanks for fixing @mrseanryan ! May I ask when you think a new version would be published to NPM?

mrseanryan commented 4 years ago

np at all - hopefully within next week or so.

pzavolinsky commented 4 years ago

@jp7837 @mrseanryan published as 6.1.0.

Thanks for this contrib!