pzavolinsky / ts-unused-exports

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

Getting unused exports error if index is not added to the import path. #289

Open AivarasBartasevicius opened 1 year ago

AivarasBartasevicius commented 1 year ago

ts-unused-exports: v9.0.5 node: v16.17.0

example:

src/interfaces/index.ts

import * as interfaceGroupOne from "./interface-group-one";
import * as interfaceGroupTwo from "./interface-group-two";

export { interfaceGroupOne, interfaceGroupTwo };

src/code/do-stuff.ts

import { interfaceGroupOne, interfaceGroupTwo } from "../interfaces";

//do stuff with interfaces

if ts-undes-export would be run in this situation, output would be src/interfaces/index.ts : interfaceGroupOne, interfaceGroupTwo even though both interfaces are imported in the do-stuff.ts file.

In case of import { interfaceGroupOne, interfaceGroupTwo } from "../interfaces/index"; it will work.

Is this how it should work.