typescript-coverage-report is a Node.js command-line tool designed to generate comprehensive type coverage reports for TypeScript projects. It visually highlights areas in the codebase that lack strong typing, helping developers track progress in TypeScript adoption or maintain strict type discipline. Currently at version 1.1.1, the package seems to follow an ad-hoc release cadence, with previous minor versions addressing specific TypeScript compatibility issues and feature enhancements. Its key differentiator is being strongly inspired by and filling a similar niche to `flow-coverage-report` in the Flow ecosystem, leveraging data from the `type-coverage` package to analyze `any` usage.
npm install typescript-coverage-reportVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `typescript-coverage-report`, configure a `package.json` script, and run the CLI tool to generate an HTML type coverage report for a basic TypeScript project, setting a custom threshold and output directory.
Before upgrading to a brand new major TypeScript version, check the `typescript-coverage-report` GitHub issues and releases for any known compatibility problems. Consider pinning your TypeScript version if encountering issues with the latest release.
Always specify an `--outputDir` (or `outputDir` in `package.json`) that is exclusively used by `typescript-coverage-report` and contains no other critical files. Consider committing generated reports to version control only if necessary, and ensure a `.gitignore` entry for the output directory.
Choose one primary method for configuration (either CLI flags or `package.json`) and stick to it to avoid confusion. If both are used, be aware that CLI flags typically override `package.json` settings for the same option.
Always explicitly specify the path to your `tsconfig.json` file using the `--project` CLI option, for example: `typescript-coverage-report --project ./path/to/my/tsconfig.json`.
Upgrade `typescript-coverage-report` to version 0.5.1 or newer to resolve this bug. `npm install typescript-coverage-report@latest`
Increase the type coverage in your project by adding more explicit type annotations, or adjust the `--threshold` CLI option or `typeCoverage.atLeast` value in `package.json` to a lower, more realistic percentage.
Verify your `tsconfig.json`'s `include` and `exclude` paths. Ensure the `--project` option is pointing to the correct `tsconfig.json`. Check that the `type-coverage` configuration within `package.json` (which `typescript-coverage-report` uses) is set up to analyze all desired files and not implicitly ignoring types.
This is a minor display bug in the HTML report and does not affect the correctness of the coverage calculation. Avoid using emojis directly in your code if you rely on the HTML report's highlighting for these specific lines. There is no direct user fix beyond avoiding the problematic characters.