-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Deprecate alwaysStrict: false in TypeScript 6.0 #63030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR deprecates the alwaysStrict: false compiler option in TypeScript 6.0, with full removal planned for 7.0. This change enables unconditional strict mode parsing, which eliminates lookahead/reparse overhead for ambiguous constructs and simplifies AST caching across projects with different compiler flags.
Changes:
- Added deprecation warning for
alwaysStrict: falsein the compiler - Created test cases to verify deprecation warning emission and silencing behavior
- Updated baseline for existing test affected by the deprecation warning
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/compiler/program.ts | Adds deprecation check for alwaysStrict: false option |
| tests/cases/compiler/alwaysStrictDeprecation.ts | Test case verifying deprecation warning is emitted |
| tests/cases/compiler/alwaysStrictDeprecationSilenced.ts | Test case verifying warning can be silenced with ignoreDeprecations: "6.0" |
| tests/baselines/reference/alwaysStrictDeprecation.errors.txt | Expected error output for deprecation warning |
| tests/baselines/reference/alwaysStrictDeprecation.js | Expected JavaScript output for deprecation test |
| tests/baselines/reference/alwaysStrictDeprecation.symbols | Expected symbol output for deprecation test |
| tests/baselines/reference/alwaysStrictDeprecation.types | Expected type output for deprecation test |
| tests/baselines/reference/alwaysStrictDeprecationSilenced.js | Expected JavaScript output when deprecation is silenced |
| tests/baselines/reference/alwaysStrictDeprecationSilenced.symbols | Expected symbol output when deprecation is silenced |
| tests/baselines/reference/alwaysStrictDeprecationSilenced.types | Expected type output when deprecation is silenced |
| tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js | Updated baseline now showing deprecation error instead of null check error |
.../baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js
Outdated
Show resolved
Hide resolved
RyanCavanaugh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot do as Jake says
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Deprecates
alwaysStrict: falsein 6.0 (will be removed in 7.0). This enables unconditional strict mode parsing, eliminating lookahead/reparse overhead for ambiguous constructs and simplifying AST caching across projects with different flags.Changes
Deprecation warning in
src/compiler/program.ts:User impact:
Tests:
alwaysStrictDeprecation.ts- verifies warning emissionalwaysStrictDeprecationSilenced.ts- verifiesignoreDeprecations: "6.0"silences warningprogramUpdates.tstest to addignoreDeprecations: "6.0"to silence the deprecation warning in theupdates-errors-when-strictNullChecks-changestest, allowing it to continue testing strictNullChecks changes without interferenceupdates-errors-when-strictNullChecks-changes.jsto reflect the silenced deprecationOriginal prompt
"use strict"everywhere by default #62213💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.