Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codechecks/typecov
Track missing type coverage to ensure type safety
https://github.com/codechecks/typecov
codechecks type-coverage type-safety typescript
Last synced: 5 days ago
JSON representation
Track missing type coverage to ensure type safety
- Host: GitHub
- URL: https://github.com/codechecks/typecov
- Owner: codechecks
- License: mit
- Created: 2019-03-18T17:50:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-28T07:16:03.000Z (almost 3 years ago)
- Last Synced: 2024-10-15T09:17:03.404Z (29 days ago)
- Topics: codechecks, type-coverage, type-safety, typescript
- Language: TypeScript
- Size: 573 KB
- Stars: 145
- Watchers: 4
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
TypeCov
Track missing type coverage in TypeScript projects to ensure type safety
## Features
👉 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## Motivation
Despite using `--strict` mode in tsconfig you can still have `any`s 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.
## Install
```sh
npm install --save-dev typecov
```## Usage
TypeCov is built on [CodeChecks.io](https://codechecks.io) - open source code review automation platform.
Are you new to codechecks? Check out [getting started guide (it's simple)](https://github.com/codechecks/docs/blob/master/getting-started.md)!
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](https://github.com/plantain-00/type-coverage) package.
## API
### typecov(options: Options): Promise\
#### 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 `string`
Defaults: `Type Coverage`
Specify the name for check. Might be useful in monorepos.##### tsconfigPath
optional `string`
Default: `tsconfig.json`
Path to typescript project configuration##### atLeast
optional `number`
Defaults: `undefined`
Example: `atLeast: 99`
Fail if coverage rate < this value.##### ignoreFiles
optional `string[]`
Defaults: `undefined`
Specify the ignored for checks files.
See [type-coverage's description](https://github.com/plantain-00/type-coverage#ignore-files) for the reference.##### ignoreCatch
optional `string`
Defaults: `undefined`
See [type-coverage's description](https://github.com/plantain-00/type-coverage#ignore-catch) for the reference.##### strict
optional `string`
Defaults: `undefined`
See [type-coverage's description](https://github.com/plantain-00/type-coverage#strict-mode) for the reference.## Contributing
All contributions are welcomed. Read more in [CONTRIBUTING.md](./CONTRIBUTING.md)
## Licence
MIT @ [codechecks.io](https://codechecks.io)