Remove unused hasWarnings and warnings - #96956
Open
martinfrancois wants to merge 1 commit into
Open
Conversation
Nothing reads these two fields on `TypeCheckResult`. `verifyAndRunTypeScript` has four callers: - `build/type-check.ts` reads only `inputFilesCount`, `totalFilesCount` and `incremental` - `next-test` reads only `version` - `setup-dev-bundler` reads only `version` - `next-typegen` throws the result away `warnings` is also always empty. It looks for diagnostics with the category `Warning`, but I checked, TypeScript 6.0.2 has no messages in that category. Deprecation messages use `Suggestion` instead. So on every build we filtered and formatted every diagnostic to build a list that was always empty, and that nobody read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing a bug
Nothing reads the two fields
hasWarningsandwarningsonTypeCheckResult.verifyAndRunTypeScripthas four callers:build/type-check.tsonly readsinputFilesCount,totalFilesCountandincrementalnext-testonly readsversionsetup-dev-bundleronly readsversionnext-typegenthrows the result awaywarningsis also always empty. It looks for diagnostics with theWarningcategory, but I checked, and TypeScript 6.0.2 has no messages in that category. Deprecation messages useSuggestioninstead.So on every build, we filtered and formatted every diagnostic to build a list that was always empty, and that nobody read.
So I'm suggesting removing it instead, as it is clearly not being used. I also checked the GitHub code search across all public repositories and couldn't find anyone using either of them. That aside, it also never really worked correctly, as it would always return
hasWarnings: trueeven ifwarningswas empty.No test added since the fields are being removed. Also since this is such a small change I didn't create an issue to link here, I'd be happy to file one if you prefer me to.
Thanks for the hard work and taking the time for reviewing this PR! 😊