-
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 |
| @@ -0,0 +1,15 @@ | |||
| /foo/tsconfig.json(3,25): error TS5107: Option 'alwaysStrict=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. | |||
Copilot
AI
Jan 22, 2026
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.
The error message contains an unnecessary level of quote nesting around ignoreDeprecations. The message should read Specify compilerOption 'ignoreDeprecations: \"6.0\"' instead of Specify compilerOption '\"ignoreDeprecations\": \"6.0\"' to match typical JSON property notation without the outer quotes around the property name.
| [[90mHH:MM:SS AM[0m] File change detected. Starting incremental compilation... | ||
|
|
||
| [96ma.ts[0m:[93m2[0m:[93m1[0m - [91merror[0m[90m TS2531: [0mObject is possibly 'null'. | ||
| [96mtsconfig.json[0m:[93m4[0m:[93m21[0m - [91merror[0m[90m TS5107: [0mOption 'alwaysStrict=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. |
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.
This test should be updated to accept the deprecation
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 warningupdates-errors-when-strictNullChecks-changes.jsOriginal prompt
"use strict"everywhere by default #62213💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.