pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive for modules dynamically loaded within a function

jp7837 opened this issue · comments

a.ts

export used = 0;

b.ts

export function dynamicallyLoadA() {
    return import("./a");
}

c.ts

import { dynamicallyLoadA } from "./b";
dynamicallyLoadA().then(A => {
    console.log(A.used);
});

A.used is not marked as used

This is another example of #144

Marking as enhancement, as it's a known limitation of the current approach.

Thanks for pointing it out though

commented

@mrseanryan If this package were to change approach, how would it be possible to detect this or even more complex code than this?