Open mrseanryan opened 4 years ago
Another example:
const module = import("./myModule");
module.then(({ usedExport }) => {
console.log(usedExport); // Or whatever
});
To support these cases, requires:
simplification: We could assume that within a nested scope, an identifier is unique
update: I'm not sure if we can ever support this 100% (at least, with the current architecture).
If a dynamic import can be assigned to a variable, then this means that the variable can be passed around into other functions, which could be in other modules (even dynamically imported modules!).
So the complexity is high.
If our architecture changed to have a fully compiled model to lean on, then this would be more practical to cover (possibly via ts-morph?).
any update about this?
The current implementation of dynamic import handling, assumes that the import and the usage of the import are within the same statement.
This issue is about cases where the import is in a separate statement, from the usage.
Example:
usedExport
is marked as unused.Originally posted by @jp7837 in https://github.com/pzavolinsky/ts-unused-exports/pull/142#issuecomment-636184346