Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prepares the TypeScript test suite for stricter compiler settings (related to #62333), particularly strictPropertyInitialization, useUnknownInCatchVariables, strictNullChecks, strictFunctionTypes, and noImplicitAny. The changes ensure tests continue to work correctly and produce expected baselines under both strict and non-strict modes.
Changes:
- Added property initializers to classes to satisfy
strictPropertyInitialization - Added compiler directives (
@strict: false,@useUnknownInCatchVariables: false,@strictPropertyInitialization: false) to tests that specifically test non-strict behavior - Converted variable initializations with widening types to
declarestatements to avoid type widening issues under strict mode - Added explicit type annotations to catch variables where needed
- Enhanced decorator metadata tests to validate behavior differences between
strictNullChecks: trueandstrictNullChecks: false(where union types serialize differently) - Updated all corresponding baseline files
Reviewed changes
Copilot reviewed 106 out of 109 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/conformance/types/**/*.ts | Added @strict: false directives to widening tests and updated test setup for strict mode compatibility |
| tests/cases/conformance/classes/**/*.ts | Added property initializers to satisfy strictPropertyInitialization |
| tests/cases/conformance/statements/**/*.ts | Added @useUnknownInCatchVariables: false to catch clause tests |
| tests/cases/compiler/Metadata.ts | Enhanced decorator metadata tests with multi-mode testing (strictNullChecks: true, false) |
| tests/cases/compiler/Catch.ts | Added @useUnknownInCatchVariables: false or explicit any type annotations to catch variables |
| tests/cases/compiler/strictNull*.ts | Added @strictPropertyInitialization: false to isolate strict null checking tests |
| tests/cases/compiler/optional*.ts | Added property initializers to classes |
| tests/cases/compiler/2dArrays.ts | Added property initializers to class properties |
| tests/baselines/reference/**/. | Updated all baseline files to reflect test changes |
jakebailey
approved these changes
Jan 13, 2026
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.
More prep for #62333
Mostly tested for
strictPropertyInitialization,useUnknownInCatchVariables, along with a few others aroundstrictNullChecks(especially the widening (and narrowing?) tests),strictFunctionTypes, and somenoImplicitAny.Worth calling out are the emit tests around decorator metadata, since
string | undefinedserializes toObjectunderstrictNullChecks: false, butstringunderstrictNullChecks: true.