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 @@ -4550,6 +4550,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
if (options.module === ModuleKind.None || options.module === ModuleKind.AMD || options.module === ModuleKind.UMD || options.module === ModuleKind.System) {
createDeprecatedDiagnostic("module", ModuleKind[options.module], /*useInstead*/ undefined, /*related*/ undefined);
}
if (options.downlevelIteration) {
createDeprecatedDiagnostic("downlevelIteration");
}
});
}

Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7431,6 +7431,7 @@ export interface CompilerOptions {
disableSourceOfProjectReferenceRedirect?: boolean;
disableSolutionSearching?: boolean;
disableReferencedProjectLoad?: boolean;
/** @deprecated */
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of33.ts (0 errors) ====
for (var v of ['a', 'b', 'c']) {
console.log(v);
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of33(target=es5).errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of33.ts (0 errors) ====
for (var v of ['a', 'b', 'c']) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of34.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of34.ts (1 errors) ====
function foo() {
return { x: 0 };
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of34(target=es5).errors.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of34.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of34.ts (1 errors) ====
function foo() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of35.ts(1,13): error TS2339: Property 'x' does not exist on type 'Number'.
ES5For-of35.ts(1,23): error TS2339: Property 'y' does not exist on type 'Number'.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of35.ts (2 errors) ====
for (const {x: a = 0, y: b = 1} of [2, 3]) {
~
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of35(target=es5).errors.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of35.ts(1,13): error TS2339: Property 'x' does not exist on type 'Number'.
ES5For-of35.ts(1,23): error TS2339: Property 'y' does not exist on type 'Number'.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of35.ts (2 errors) ====
for (const {x: a = 0, y: b = 1} of [2, 3]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of36.ts(1,10): error TS2488: Type 'number' must have a '[Symbol.iterator]()' method that returns an iterator.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of36.ts (1 errors) ====
for (let [a = 0, b = 1] of [2, 3]) {
~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of36(target=es5).errors.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
ES5For-of36.ts(1,10): error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of36.ts (1 errors) ====
for (let [a = 0, b = 1] of [2, 3]) {
Expand Down
20 changes: 20 additions & 0 deletions tests/baselines/reference/ES5For-of37(target=es2015).errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of37.ts (0 errors) ====
// https://github.com/microsoft/TypeScript/issues/30083

for (const i of [0, 1, 2, 3, 4]) {
try {
// Ensure catch binding for the following loop is reset per iteration:
for (const j of [1, 2, 3]) {
if (i === 2) {
throw new Error('ERR');
}
}
console.log(i);
} catch (err) {
console.log('E %s %s', i, err);
}
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of37(target=es2015).types
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ for (const i of [0, 1, 2, 3, 4]) {

} catch (err) {
>err : any
> : ^^^

console.log('E %s %s', i, err);
>console.log('E %s %s', i, err) : void
Expand All @@ -79,5 +80,6 @@ for (const i of [0, 1, 2, 3, 4]) {
>i : number
> : ^^^^^^
>err : any
> : ^^^
}
}
2 changes: 2 additions & 0 deletions tests/baselines/reference/ES5For-of37(target=es5).errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== ES5For-of37.ts (0 errors) ====
// https://github.com/microsoft/TypeScript/issues/30083
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7033,6 +7033,7 @@ declare namespace ts {
disableSourceOfProjectReferenceRedirect?: boolean;
disableSolutionSearching?: boolean;
disableReferencedProjectLoad?: boolean;
/** @deprecated */
downlevelIteration?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
Expand Down
28 changes: 28 additions & 0 deletions tests/baselines/reference/arrayLiteralSpreadES5iterable.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== arrayLiteralSpreadES5iterable.ts (0 errors) ====
function f0() {
var a = [1, 2, 3];
var a1 = [...a];
var a2 = [1, ...a];
var a3 = [1, 2, ...a];
var a4 = [...a, 1];
var a5 = [...a, 1, 2];
var a6 = [1, 2, ...a, 1, 2];
var a7 = [1, ...a, 2, ...a];
var a8 = [...a, ...a, ...a];
}

function f1() {
var a = [1, 2, 3];
var b = ["hello", ...a, true];
var b: (string | number | boolean)[];
}

function f2() {
var a = [...[...[...[...[...[]]]]]];
var b = [...[...[...[...[...[5]]]]]];
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== asyncArrowFunction11_es5.ts (0 errors) ====
// https://github.com/Microsoft/TypeScript/issues/24722
class A {
b = async (...args: any[]) => {
await Promise.resolve();
const obj = { ["a"]: () => this }; // computed property name after `await` triggers case
};
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== asyncArrowFunction11_es5.ts (0 errors) ====
// https://github.com/Microsoft/TypeScript/issues/24722
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== blockScopedBindingsInDownlevelGenerator.ts (0 errors) ====
function* a() {
for (const i of [1,2,3]) {
(() => i)()
yield i
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function* a() {

yield i
>yield i : any
> : ^^^
>i : number
> : ^^^^^^
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== blockScopedBindingsInDownlevelGenerator.ts (0 errors) ====
function* a() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(43,6): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
destructuringArrayBindingPatternAndAssignment1ES5iterable.ts(44,18): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringArrayBindingPatternAndAssignment1ES5iterable.ts (3 errors) ====
/* AssignmentPattern:
* ObjectAssignmentPattern
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringArrayBindingPatternAndAssignment4.ts(5,7): error TS2488: Type 'number[] | null' must have a '[Symbol.iterator]()' method that returns an iterator.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringArrayBindingPatternAndAssignment4.ts (1 errors) ====
// #35497

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringArrayBindingPatternAndAssignment4.ts(5,7): error TS2548: Type 'number[] | null' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringArrayBindingPatternAndAssignment4.ts (1 errors) ====
// #35497
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringParameterDeclaration1ES5iterable.ts(12,4): error TS2345: Argument of type '[number, number, string[][], number]' is not assignable to parameter of type '[number, number, string[][]]'.
Source has 4 element(s) but target allows only 3.
destructuringParameterDeclaration1ES5iterable.ts(57,4): error TS2345: Argument of type '[number, number, [[string]], boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
Expand All @@ -6,6 +7,7 @@ destructuringParameterDeclaration1ES5iterable.ts(62,10): error TS2393: Duplicate
destructuringParameterDeclaration1ES5iterable.ts(63,10): error TS2393: Duplicate function implementation.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringParameterDeclaration1ES5iterable.ts (4 errors) ====
// A parameter declaration may specify either an identifier or a binding pattern.
// The identifiers specified in parameter declarations and binding patterns
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringParameterDeclaration3ES5iterable.ts(26,4): error TS2345: Argument of type '[number, number, [[string]], boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
Source has 5 element(s) but target allows only 3.
destructuringParameterDeclaration3ES5iterable.ts(29,12): error TS2322: Type 'number' is not assignable to type '[[any]]'.
destructuringParameterDeclaration3ES5iterable.ts(30,5): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]], ...any[]]'.
Source has 2 element(s) but target requires 3.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringParameterDeclaration3ES5iterable.ts (3 errors) ====
// If the parameter is a rest parameter, the parameter type is any[]
// A type annotation for a rest parameter must denote an array type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
destructuringParameterDeclaration3ES5iterable.ts(26,4): error TS2345: Argument of type '[number, number, [[string]], boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
Source has 5 element(s) but target allows only 3.
Expand All @@ -6,6 +7,7 @@ destructuringParameterDeclaration3ES5iterable.ts(30,5): error TS2345: Argument o
Source has 2 element(s) but target requires 3.


!!! error TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== destructuringParameterDeclaration3ES5iterable.ts (3 errors) ====
// If the parameter is a rest parameter, the parameter type is any[]
Expand Down
Loading