Visual Code : How to detect dead typescript code Visual Code : How to detect dead typescript code typescript typescript

Visual Code : How to detect dead typescript code


Have a look to https://www.npmjs.com/package/ts-unused-exports

It produces an output like this

$ ts-unused-exports tsconfig.json4 modules with unused exportssrc/lambda: handlersrc/routes/crud: default


Well, I don't think you can do that for all your code, but you can open the context menu over a method/function/property, and then select 'find all references'. If none is found, you can mark it as a candidate for deletion.

Of course this method is not perfect. For example, you could call a method from an object which is an instance of a class but has been cast to any previously, but it's a starting point.


I had the same problem, and dpdm was the best found solution. But I wanted one integrated in Visual Code so in the end was created an extension named Find unused exports. It allows to easily see and go to unused exports in a js/ts project.