chore: enable TypeScript strict mode#3112
Open
kyungseopk1m wants to merge 2 commits intofirebase:mainfrom
Open
chore: enable TypeScript strict mode#3112kyungseopk1m wants to merge 2 commits intofirebase:mainfrom
kyungseopk1m wants to merge 2 commits intofirebase:mainfrom
Conversation
Replace individual strict compiler options with "strict": true in tsconfig.json. This also enables strictPropertyInitialization, which required adding definite assignment assertions (!:) to properties initialized via Object.defineProperty helpers or Promise executors. Additionally fixes useUnknownInCatchVariables errors introduced by the new flag.
Contributor
There was a problem hiding this comment.
Code Review
This pull request enables strict type checking in the TypeScript configuration and updates the codebase to comply with these stricter rules. The changes involve adding definite assignment assertions, making certain properties optional, and explicitly casting error types in catch blocks across various modules. Additionally, the RemoteConfig implementation was refactored to centralize cache validation into a new helper method, supported by additional unit tests. Review feedback suggests using dynamic method names instead of hardcoded strings in error messages to improve maintainability.
| 'failed-precondition', | ||
| 'No Remote Config Server template in cache. Call load() before calling evaluate().'); | ||
| } | ||
| const cachedTemplate = this.getCachedTemplate('evaluate()'); |
Contributor
| * @returns JSON representation of the server template | ||
| */ | ||
| public toJSON(): ServerTemplateData { | ||
| return this.getCachedTemplate('toJSON()'); |
Contributor
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.
Summary
Completes the long-standing TODO in
tsconfig.json:"strict": truestrictPropertyInitialization(previously commented out)TS2564errors using definite assignment assertions (!:) for properties initialized viaObject.defineProperty-based helpers (addReadonlyGetter,copyAttr) or Promise executor callbacksTS18046errors from newly enableduseUnknownInCatchVariableswithas Errorcasts in catch blocksServerTemplateImpl.cacheto use optional type (?:) with agetCachedTemplate()helper for proper runtime validation; adds corresponding testsChanges
tsconfig.json"strict": truesrc/**/*.ts(16 files)!:/?:/as Errorto resolve new strict errorstest/unit/remote-config/remote-config.spec.tstsc --noEmitpasses with zero errors after these changes.