Track type coverage in TypeScript projects to ensure type safety
npm install typecov

Track missing type coverage in TypeScript projects to ensure type safety
š track type coverage defined as the count of symbols whose type is not any / the total count of symbols
š display type coverage directly in GitHub
š set minimal type coverage and automatically fail PRs
š supports monorepos
Despite using --strict mode in tsconfig you can still have anys in your codebase. This tool gives you a good overview if PR that you are going to merge increases or decreases overall type coverage and where exactly types should be improved.
``sh`
npm install --save-dev typecov
TypeCov is built on CodeChecks.io - open source code review automation platform.
Are you new to codechecks? Check out getting started guide (it's simple)!
Install package and then add to your codechecks.yml file:
`yml`
checks:
- name: typecov
options:
# atLeast: 99
# name: webapp
# tsconfigPath: ./tsconfig.prod.json
Under the hood it uses type-coverage package.
#### options
`typescript`
interface Options {
name?: string; // will be added to check name
tsconfigPath?: string; //defaults to tsconfig.json
atLeast?: number;
ignoreFiles?: string[];
ignoreCatch?: boolean;
strict?: boolean;
}
##### name
optional stringType Coverage
Defaults:
Specify the name for check. Might be useful in monorepos.
##### tsconfigPath
optional stringtsconfig.json
Default:
Path to typescript project configuration
##### atLeast
optional numberundefined
Defaults: atLeast: 99
Example:
Fail if coverage rate < this value.
##### ignoreFiles
optional string[]undefined
Defaults:
Specify the ignored for checks files.
See type-coverage's description for the reference.
##### ignoreCatch
optional stringundefined
Defaults:
See type-coverage's description for the reference.
##### strict
optional stringundefined`
Defaults:
See type-coverage's description for the reference.
All contributions are welcomed. Read more in CONTRIBUTING.md
MIT @ codechecks.io