microsoft / microsoft/TypeScript
Ability to only check specific errors
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search Terms
specific errors ignore whitelist enable only
Suggestion
Ability to specify what errors you would like to see caught in the tsconfig.json. Errors not in the whitelist would be ignored.
Use Cases
Migrating large projects to Typescript. If the migration is done in a by-error-type approach you can't turn type-checking on in CI until all problems are fixed, which can take a long time when there is other work to do.
Examples
{
"whitelistErrors": [7017, 2322, 2344]
}
Errors other than TS7017, TS2322, TS2344 would be ignored.
This suggestion is the inverse of https://github.com/microsoft/TypeScript/issues/29950
You can see an example of the opposite (blacklist errors) here: https://github.com/evolution-gaming/tsc-silent
Pytype, google's type-checker for python, also has the ability to blacklist specific errors.
# Comma separated list of error names to ignore.
disable =
attribute-error
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Note that this might lead to bad practice where developers lazily only check for certain errors rather than fixing their broken types. Using this feature should be discouraged unless used as a temporary measure for migrating from JS projects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing how tsconfig.json options are handled and compare this proposal with the inverse behavior discussed in issue #29950. The issue describes a whitelist of diagnostic codes for TypeScript checking; done would mean non-whitelisted errors are ignored without changing emitted JavaScript, with the behavior covered by compiler tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100