Shamefully stolen CLI wannabe version of https://gist.github.com/dsherret/0bae87310ce24866ae22425af80a9864 built on top of excellent typescript service api wrapper https://github.com/dsherret/ts-morph
All credit goes to @dsherret.
$ cd my-project/
$ npx unused-exports.ts # defaults with checking project sources files declared in ./tsconfig.json.
- custom tsconfig path (defaults to current directory tsconfig.json)
$ npx unused-exports.ts --config my-project/path/to/tsconfig.json
- custom file patterns exclusion
$ npx unused-exports.ts 'path/to/include/**/*' '!path/to/include/not/**/*'