https://github.com/kawamataryo/suppress-ts-errors
CLI tool to add @ts-expect-errors to typescript type errors
https://github.com/kawamataryo/suppress-ts-errors
cli nodejs typescript
Last synced: about 1 year ago
JSON representation
CLI tool to add @ts-expect-errors to typescript type errors
- Host: GitHub
- URL: https://github.com/kawamataryo/suppress-ts-errors
- Owner: kawamataryo
- License: mit
- Created: 2022-04-30T07:56:39.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T22:45:50.000Z (about 1 year ago)
- Last Synced: 2025-04-13T04:16:30.190Z (about 1 year ago)
- Topics: cli, nodejs, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/suppress-ts-errors
- Size: 1.6 MB
- Stars: 133
- Watchers: 2
- Forks: 13
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# suppress-ts-errors
[](https://github.com/kawamataryo/suppress-ts-errors/actions/workflows/ci.yml)

Cli tool to add comments to suppress typescript type errors.
Add [@ts-expect-error](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments) or [@ts-ignore](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#suppress-errors-in-ts-files-using--ts-ignore-comments) comments to all locations where errors are occurring.
Support for `.ts`, `.tsx`, `.vue`.

## 🚀 Usage
### Running scripts to `.ts` and `.tsx`
Run the script in the directory where `tsconfig.json` is located.
```bash
$ npx suppress-ts-errors
```
### Running scripts to `.vue`
When targeting vue sfc, the path of the vue component must be specified with the glob pattern.
**Notice:** It does not support commenting out type errors in the `` section of vue, only the `` section.
```bash
$ npx suppress-ts-errors vue src/**/*.vue
```
### options
| option | default | description |
| ------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -t, --tsconfig-path | `./tsconfig.json` | Path to tsconfig.json. |
| -c, --comment-type | `1` | Choice of inserted comment type. <br> `1` is [@ts-expect-error](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments), `2` is [@ts-ignore](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#suppress-errors-in-ts-files-using--ts-ignore-comments). |
| -e, --error-code | `true` | Add error code to comment. e.g. TS2345. |
| -g, --glob | `undefined` | Add a specific glob for error suppression (prevents script from processing all files and their dependencies) |
| -m, --message | `undefined` | Add a custom message to the comment. |
## ✨ Contributing
Contributions are welcome 🎉
We accept contributions via Pull Requests. See [this guide](https://github.com/kawamataryo/suppress-ts-errors/blob/main/CONTRIBUTING.md) on how to make a contribution.
## 📄 License
suppress-ts-errors is available under the MIT License.