I've created a reproduction at https://github.com/shawnmcknight/knip-enum-object-values.
In this scenario, there is an enum
with initializers:
export enum Fruits {
apple = "apple",
orange = "orange",
}
That enum is imported and run through any of the Object property enumerators:
const fruitKeys = Object.keys(Fruits);
const fruitValues = Object.values(Fruits);
const fruitEntries = Object.entries(Fruits);
With this code, each enum member is reported as unused by knip, but effectively every enumerated value is being used. I'm not sure I would consider Object.keys
to be "using" the enum member, but both Object.values
and Object.entries
are consuming the entirety of the enumeration.
Please let me know if there is anything else I can provide to assist!
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