https://codesandbox.io/p/devbox/wp5lv3
I found a situation in which an export * from "./b";
line is unused (removing it makes no difference), but Knip doesnโt report anything:
// a.ts
export const a = "a";
// b.ts
export const b = "b";
// aAndB.ts
export * from "./a";
export * from "./b"; // Unused line?
// index.ts
import { a } from "./aAndB";
import { b } from "./b";
console.log(a, b);
Note that both a
and b
are used, but b
is imported directly rather than being imported from the barrel file. This is a sign of a potential issue, that maybe b
was meant to be imported from aAndB
instead.
Itโs not a big issue, as there isnโt any actual code that is unused (except from the export *
line which will most likely disappear after bundling anyway), and supporting this use case would maybe require a whole new category of things that can be potentially unused, but I felt like I should report it anyway if you feel like it should be fixed.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too