I have a language file which exports the texts as object literal,
export const lang = {
hello : `hello`,
calculate : (value = 0) => `the value is ${value}`,
nested: {
value: 'nested value'
}
}
This constant is imported by many different files in the project. I am trying to find the properties that are un used and remove them.
const project = new Project({ tsConfigFilePath: 'tsconfig.webpack.json' });
const source = project.addSourceFileAtPathIfExists('constants.ts');
const messages = source?.getVariableDeclarationOrThrow('lang');
const value = messages?.getInitializerOrThrow();
const properties = (value as ObjectLiteralExpression)?.getProperties() ?? [];
// I can iterate each property and their child but how to check if they are unused??
Is there any way to know that a property is un used and remove it?