Deprecate alwaysStrict: false in TypeScript 6.0#63030
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.
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.
@copilot do as Jake says
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
|
@typescript-bot test it |
|
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
|
@jakebailey Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
|
This PR seems correct enough, but I think we might be forced to check |
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.