Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4526,6 +4526,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
});

checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
if (options.alwaysStrict === false) {
createDeprecatedDiagnostic("alwaysStrict", "false", /*useInstead*/ undefined, /*related*/ undefined);
}
if (options.moduleResolution === ModuleResolutionKind.Node10) {
createDeprecatedDiagnostic("moduleResolution", "node10", /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
}
Expand Down
2 changes: 1 addition & 1 deletion src/testRunner/unittests/tscWatch/programUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ foo().hello`,
},
{
caption: "Set always strict false",
edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, jsonToReadableText({ compilerOptions: { strict: true, alwaysStrict: false } })), // Avoid changing 'alwaysStrict' or must re-bind
edit: sys => sys.writeFile(`/user/username/projects/myproject/tsconfig.json`, jsonToReadableText({ compilerOptions: { strict: true, alwaysStrict: false, ignoreDeprecations: "6.0" } })), // Avoid changing 'alwaysStrict' or must re-bind
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
Expand Down
15 changes: 15 additions & 0 deletions tests/baselines/reference/alwaysStrictDeprecation.errors.txt
Original file line number Diff line number Diff line change
@@ -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.


==== /foo/tsconfig.json (1 errors) ====
{
"compilerOptions": {
"alwaysStrict": false
~~~~~
!!! error TS5107: Option 'alwaysStrict=false' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
}
}

==== /foo/a.ts (0 errors) ====
const a = 1;

8 changes: 8 additions & 0 deletions tests/baselines/reference/alwaysStrictDeprecation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [tests/cases/compiler/alwaysStrictDeprecation.ts] ////

//// [a.ts]
const a = 1;


//// [a.js]
var a = 1;
6 changes: 6 additions & 0 deletions tests/baselines/reference/alwaysStrictDeprecation.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//// [tests/cases/compiler/alwaysStrictDeprecation.ts] ////

=== /foo/a.ts ===
const a = 1;
>a : Symbol(a, Decl(a.ts, 0, 5))

9 changes: 9 additions & 0 deletions tests/baselines/reference/alwaysStrictDeprecation.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [tests/cases/compiler/alwaysStrictDeprecation.ts] ////

=== /foo/a.ts ===
const a = 1;
>a : 1
> : ^
>1 : 1
> : ^

8 changes: 8 additions & 0 deletions tests/baselines/reference/alwaysStrictDeprecationSilenced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [tests/cases/compiler/alwaysStrictDeprecationSilenced.ts] ////

//// [a.ts]
const a = 1;


//// [a.js]
var a = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//// [tests/cases/compiler/alwaysStrictDeprecationSilenced.ts] ////

=== /foo/a.ts ===
const a = 1;
>a : Symbol(a, Decl(a.ts, 0, 5))

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [tests/cases/compiler/alwaysStrictDeprecationSilenced.ts] ////

=== /foo/a.ts ===
const a = 1;
>a : 1
> : ^
>1 : 1
> : ^

Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ Input::
{
"compilerOptions": {
"strict": true,
"alwaysStrict": false
"alwaysStrict": false,
"ignoreDeprecations": "6.0"
}
}

Expand Down Expand Up @@ -174,6 +175,7 @@ Program root files: [
Program options: {
"strict": true,
"alwaysStrict": false,
"ignoreDeprecations": "6.0",
"watch": true,
"configFilePath": "/user/username/projects/myproject/tsconfig.json"
}
Expand Down
10 changes: 10 additions & 0 deletions tests/cases/compiler/alwaysStrictDeprecation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @typeScriptVersion: 6.0
// @filename: /foo/tsconfig.json
{
"compilerOptions": {
"alwaysStrict": false
}
}

// @filename: /foo/a.ts
const a = 1;
11 changes: 11 additions & 0 deletions tests/cases/compiler/alwaysStrictDeprecationSilenced.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @typeScriptVersion: 6.0
// @filename: /foo/tsconfig.json
{
"compilerOptions": {
"alwaysStrict": false,
"ignoreDeprecations": "6.0"
}
}

// @filename: /foo/a.ts
const a = 1;