From b1a582ce2a601eebd30ab5f0f5e03f5184d8f04f Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 30 Jan 2026 12:37:40 -0800 Subject: [PATCH 1/3] Add tests --- src/compiler/checker.ts | 10 +- ...rent(nolib=false,target=es2015).errors.txt | 32 +++ ...getDifferent(nolib=false,target=es2015).js | 41 +++ ...fferent(nolib=false,target=es2015).symbols | 51 ++++ ...Different(nolib=false,target=es2015).types | 88 ++++++ ...fferent(nolib=false,target=es5).errors.txt | 32 +++ ...TargetDifferent(nolib=false,target=es5).js | 45 +++ ...tDifferent(nolib=false,target=es5).symbols | 51 ++++ ...getDifferent(nolib=false,target=es5).types | 88 ++++++ ...rent(nolib=false,target=esnext).errors.txt | 32 +++ ...getDifferent(nolib=false,target=esnext).js | 41 +++ ...fferent(nolib=false,target=esnext).symbols | 51 ++++ ...Different(nolib=false,target=esnext).types | 88 ++++++ ...erent(nolib=true,target=es2015).errors.txt | 57 ++++ ...rgetDifferent(nolib=true,target=es2015).js | 41 +++ ...ifferent(nolib=true,target=es2015).symbols | 51 ++++ ...tDifferent(nolib=true,target=es2015).types | 88 ++++++ ...ifferent(nolib=true,target=es5).errors.txt | 57 ++++ ...5TargetDifferent(nolib=true,target=es5).js | 45 +++ ...etDifferent(nolib=true,target=es5).symbols | 51 ++++ ...rgetDifferent(nolib=true,target=es5).types | 88 ++++++ ...erent(nolib=true,target=esnext).errors.txt | 57 ++++ ...rgetDifferent(nolib=true,target=esnext).js | 41 +++ ...ifferent(nolib=true,target=esnext).symbols | 51 ++++ ...tDifferent(nolib=true,target=esnext).types | 88 ++++++ .../reference/noCrashOnNoLib.errors.txt | 5 +- ...ayBindingPattern(target=es2015).errors.txt | 92 +----- ...orArrayBindingPattern(target=es2015).types | 8 +- ...yBindingPattern2(target=es2015).errors.txt | 191 ------------- ...rArrayBindingPattern2(target=es2015).types | 25 +- ...ernDefaultValues(target=es2015).errors.txt | 234 ---------------- ...gPatternDefaultValues(target=es2015).types | 1 - ...rnDefaultValues2(target=es2015).errors.txt | 240 ---------------- ...PatternDefaultValues2(target=es2015).types | 13 +- ...ayBindingPattern(target=es2015).errors.txt | 170 ----------- ...OfArrayBindingPattern(target=es2015).types | 265 +++++++++--------- ...yBindingPattern2(target=es2015).errors.txt | 175 ------------ ...fArrayBindingPattern2(target=es2015).types | 25 +- ...ernDefaultValues(target=es2015).errors.txt | 170 ----------- ...gPatternDefaultValues(target=es2015).types | 241 ++++++++-------- ...rnDefaultValues2(target=es2015).errors.txt | 211 -------------- ...PatternDefaultValues2(target=es2015).types | 13 +- ...ctBindingPattern(target=es2015).errors.txt | 108 ------- ...bjectBindingPattern(target=es2015).symbols | 30 ++ ...fObjectBindingPattern(target=es2015).types | 145 +++++----- ...tBindingPattern2(target=es2015).errors.txt | 188 ------------- ...ObjectBindingPattern2(target=es2015).types | 1 - ...ernDefaultValues(target=es2015).errors.txt | 130 --------- ...atternDefaultValues(target=es2015).symbols | 33 +++ ...gPatternDefaultValues(target=es2015).types | 145 +++++----- ...rnDefaultValues2(target=es2015).errors.txt | 245 ---------------- ...PatternDefaultValues2(target=es2015).types | 1 - ...ayBindingPattern(target=es2015).errors.txt | 48 ---- ...rtArrayBindingPattern(target=es2015).types | 1 - ...yBindingPattern2(target=es2015).errors.txt | 51 ---- ...tArrayBindingPattern2(target=es2015).types | 1 - ...ernDefaultValues(target=es2015).errors.txt | 48 ---- ...gPatternDefaultValues(target=es2015).types | 1 - ...rnDefaultValues2(target=es2015).errors.txt | 50 ---- ...PatternDefaultValues2(target=es2015).types | 1 - ...ayBindingPattern(target=es2015).errors.txt | 41 --- ...yBindingPattern2(target=es2015).errors.txt | 46 --- ...yBindingPattern3(target=es2015).errors.txt | 140 --------- ...tArrayBindingPattern3(target=es2015).types | 25 +- ...ernDefaultValues(target=es2015).errors.txt | 40 --- ...rnDefaultValues2(target=es2015).errors.txt | 41 --- ...rnDefaultValues3(target=es2015).errors.txt | 138 --------- ...PatternDefaultValues3(target=es2015).types | 13 +- .../types.forAwait.es2018.3.errors.txt | 16 +- ...aluesAndEntries1(target=es2015).errors.txt | 36 --- ...jectValuesAndEntries1(target=es2015).types | 12 +- .../arrayIterationLibES5TargetDifferent.ts | 28 ++ 72 files changed, 1927 insertions(+), 3320 deletions(-) create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).types create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).types create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).types create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).types create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).types create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).js create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).symbols create mode 100644 tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).types delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).errors.txt delete mode 100644 tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).errors.txt create mode 100644 tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5d446f6799418..2065cc496d848 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -25480,7 +25480,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function isArrayLikeType(type: Type): boolean { // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, - // or if it is not the undefined or null type and if it is assignable to ReadonlyArray + // or if it is not the undefined or null type and if it is assignable to ReadonlyArray. + // When Array doesn't exist (noLib), we can't determine array-likeness. + if (anyReadonlyArrayType === emptyObjectType) { + return false; + } return isArrayType(type) || !(type.flags & TypeFlags.Nullable) && isTypeAssignableTo(type, anyReadonlyArrayType); } @@ -45619,7 +45623,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return undefined; } - const uplevelIteration = languageVersion >= ScriptTarget.ES2015; + const iterableExists = getGlobalIterableType(/*reportErrors*/ false) !== emptyGenericType; + // Only use iteration semantics when Iterable exists; otherwise fall through to array-like handling. + const uplevelIteration = languageVersion >= ScriptTarget.ES2015 && iterableExists; const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & IterationUse.PossiblyOutOfBounds); diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).errors.txt new file mode 100644 index 0000000000000..ce984d1c13283 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).errors.txt @@ -0,0 +1,32 @@ +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +==== arrayIterationLibES5TargetDifferent.ts (2 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).js new file mode 100644 index 0000000000000..4fae88f865ff2 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (const x of [1, 2, 3]) { + log(x); +} +for (const x of aString) { + log(x); +} +for (const x of aNumber) { + log(x); +} +for (const x of anObject) { + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).types new file mode 100644 index 0000000000000..d8aebdc010118 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es2015).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : number +> : ^^^^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).errors.txt new file mode 100644 index 0000000000000..ce984d1c13283 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).errors.txt @@ -0,0 +1,32 @@ +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +==== arrayIterationLibES5TargetDifferent.ts (2 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).js new file mode 100644 index 0000000000000..2511293911245 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var x = _a[_i]; + log(x); +} +for (var _b = 0, aString_1 = aString; _b < aString_1.length; _b++) { + var x = aString_1[_b]; + log(x); +} +for (var _c = 0, aNumber_1 = aNumber; _c < aNumber_1.length; _c++) { + var x = aNumber_1[_c]; + log(x); +} +for (var _d = 0, anObject_1 = anObject; _d < anObject_1.length; _d++) { + var x = anObject_1[_d]; + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).types new file mode 100644 index 0000000000000..d8aebdc010118 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=es5).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : number +> : ^^^^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).errors.txt new file mode 100644 index 0000000000000..ce984d1c13283 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).errors.txt @@ -0,0 +1,32 @@ +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +==== arrayIterationLibES5TargetDifferent.ts (2 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).js new file mode 100644 index 0000000000000..4fae88f865ff2 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (const x of [1, 2, 3]) { + log(x); +} +for (const x of aString) { + log(x); +} +for (const x of aNumber) { + log(x); +} +for (const x of anObject) { + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).types new file mode 100644 index 0000000000000..d8aebdc010118 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=false,target=esnext).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : number +> : ^^^^^^ +>[1, 2, 3] : number[] +> : ^^^^^^^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : number +> : ^^^^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt new file mode 100644 index 0000000000000..481b7447ceb37 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt @@ -0,0 +1,57 @@ +error TS2318: Cannot find global type 'Array'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'CallableFunction'. +error TS2318: Cannot find global type 'Function'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'NewableFunction'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'RegExp'. +error TS2318: Cannot find global type 'String'. +error TS5053: Option 'lib' cannot be specified with option 'noLib'. +arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +!!! error TS2318: Cannot find global type 'Array'. +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'CallableFunction'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'NewableFunction'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'RegExp'. +!!! error TS2318: Cannot find global type 'String'. +!!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. +==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + ~~~~~~~~~ +!!! error TS2495: Type '{}' is not an array type or a string type. + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).js new file mode 100644 index 0000000000000..4fae88f865ff2 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (const x of [1, 2, 3]) { + log(x); +} +for (const x of aString) { + log(x); +} +for (const x of aNumber) { + log(x); +} +for (const x of anObject) { + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).types new file mode 100644 index 0000000000000..b442bce581e58 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : any +> : ^^^ +>[1, 2, 3] : {} +> : ^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt new file mode 100644 index 0000000000000..481b7447ceb37 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt @@ -0,0 +1,57 @@ +error TS2318: Cannot find global type 'Array'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'CallableFunction'. +error TS2318: Cannot find global type 'Function'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'NewableFunction'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'RegExp'. +error TS2318: Cannot find global type 'String'. +error TS5053: Option 'lib' cannot be specified with option 'noLib'. +arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +!!! error TS2318: Cannot find global type 'Array'. +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'CallableFunction'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'NewableFunction'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'RegExp'. +!!! error TS2318: Cannot find global type 'String'. +!!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. +==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + ~~~~~~~~~ +!!! error TS2495: Type '{}' is not an array type or a string type. + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).js new file mode 100644 index 0000000000000..2511293911245 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).js @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var x = _a[_i]; + log(x); +} +for (var _b = 0, aString_1 = aString; _b < aString_1.length; _b++) { + var x = aString_1[_b]; + log(x); +} +for (var _c = 0, aNumber_1 = aNumber; _c < aNumber_1.length; _c++) { + var x = aNumber_1[_c]; + log(x); +} +for (var _d = 0, anObject_1 = anObject; _d < anObject_1.length; _d++) { + var x = anObject_1[_d]; + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).types new file mode 100644 index 0000000000000..b442bce581e58 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : any +> : ^^^ +>[1, 2, 3] : {} +> : ^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt new file mode 100644 index 0000000000000..481b7447ceb37 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt @@ -0,0 +1,57 @@ +error TS2318: Cannot find global type 'Array'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'CallableFunction'. +error TS2318: Cannot find global type 'Function'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'NewableFunction'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'RegExp'. +error TS2318: Cannot find global type 'String'. +error TS5053: Option 'lib' cannot be specified with option 'noLib'. +arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. +arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. + + +!!! error TS2318: Cannot find global type 'Array'. +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'CallableFunction'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'NewableFunction'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'RegExp'. +!!! error TS2318: Cannot find global type 'String'. +!!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. +==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== + declare function log(message?: any): void; + + for (const x of [1, 2, 3]) { + ~~~~~~~~~ +!!! error TS2495: Type '{}' is not an array type or a string type. + log(x); + } + + declare const aString: string; + + for (const x of aString) { + log(x); + } + + declare const aNumber: number; + + for (const x of aNumber) { + ~~~~~~~ +!!! error TS2495: Type 'number' is not an array type or a string type. + log(x); + } + + declare const anObject: { foo: string }; + + for (const x of anObject) { + ~~~~~~~~ +!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. + log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).js b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).js new file mode 100644 index 0000000000000..4fae88f865ff2 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).js @@ -0,0 +1,41 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +//// [arrayIterationLibES5TargetDifferent.ts] +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} + +//// [arrayIterationLibES5TargetDifferent.js] +"use strict"; +for (const x of [1, 2, 3]) { + log(x); +} +for (const x of aString) { + log(x); +} +for (const x of aNumber) { + log(x); +} +for (const x of anObject) { + log(x); +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).symbols b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).symbols new file mode 100644 index 0000000000000..6fba112cb1b2c --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).symbols @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>message : Symbol(message, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 21)) + +for (const x of [1, 2, 3]) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 2, 10)) +} + +declare const aString: string; +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + +for (const x of aString) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +>aString : Symbol(aString, Decl(arrayIterationLibES5TargetDifferent.ts, 6, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 8, 10)) +} + +declare const aNumber: number; +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + +for (const x of aNumber) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +>aNumber : Symbol(aNumber, Decl(arrayIterationLibES5TargetDifferent.ts, 12, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 14, 10)) +} + +declare const anObject: { foo: string }; +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) +>foo : Symbol(foo, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 25)) + +for (const x of anObject) { +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +>anObject : Symbol(anObject, Decl(arrayIterationLibES5TargetDifferent.ts, 18, 13)) + + log(x); +>log : Symbol(log, Decl(arrayIterationLibES5TargetDifferent.ts, 0, 0)) +>x : Symbol(x, Decl(arrayIterationLibES5TargetDifferent.ts, 20, 10)) +} diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).types b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).types new file mode 100644 index 0000000000000..b442bce581e58 --- /dev/null +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).types @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts] //// + +=== arrayIterationLibES5TargetDifferent.ts === +declare function log(message?: any): void; +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>message : any +> : ^^^ + +for (const x of [1, 2, 3]) { +>x : any +> : ^^^ +>[1, 2, 3] : {} +> : ^^ +>1 : 1 +> : ^ +>2 : 2 +> : ^ +>3 : 3 +> : ^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const aString: string; +>aString : string +> : ^^^^^^ + +for (const x of aString) { +>x : string +> : ^^^^^^ +>aString : string +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : string +> : ^^^^^^ +} + +declare const aNumber: number; +>aNumber : number +> : ^^^^^^ + +for (const x of aNumber) { +>x : any +> : ^^^ +>aNumber : number +> : ^^^^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} + +declare const anObject: { foo: string }; +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ +>foo : string +> : ^^^^^^ + +for (const x of anObject) { +>x : any +> : ^^^ +>anObject : { foo: string; } +> : ^^^^^^^ ^^^ + + log(x); +>log(x) : void +> : ^^^^ +>log : (message?: any) => void +> : ^ ^^^ ^^^^^ +>x : any +> : ^^^ +} diff --git a/tests/baselines/reference/noCrashOnNoLib.errors.txt b/tests/baselines/reference/noCrashOnNoLib.errors.txt index e8c7885ffadc3..bc1da7fe28b9a 100644 --- a/tests/baselines/reference/noCrashOnNoLib.errors.txt +++ b/tests/baselines/reference/noCrashOnNoLib.errors.txt @@ -6,6 +6,7 @@ error TS2318: Cannot find global type 'Number'. error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. +noCrashOnNoLib.ts(4,15): error TS2461: Type '{}' is not an array type. !!! error TS2318: Cannot find global type 'Array'. @@ -16,10 +17,12 @@ error TS2318: Cannot find global type 'String'. !!! error TS2318: Cannot find global type 'Object'. !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. -==== noCrashOnNoLib.ts (0 errors) ==== +==== noCrashOnNoLib.ts (1 errors) ==== export function f() { let e: {}[] = []; while (true) { e = [...(e || [])]; + ~~~~~~~~~ +!!! error TS2461: Type '{}' is not an array type. } } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).errors.txt index 5bf3ef28324ee..1fa861602aa0f 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).errors.txt +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).errors.txt @@ -1,38 +1,8 @@ error TS2318: Cannot find global type 'Iterable'. -sourceMapValidationDestructuringForArrayBindingPattern.ts(18,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(21,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(24,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(27,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(27,13): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(30,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(30,13): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(33,10): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(33,13): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(37,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(40,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(43,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(46,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(49,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(52,10): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(56,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(59,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(62,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(65,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(65,19): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(68,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(68,19): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(71,10): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(71,19): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(75,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(78,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(81,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(84,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(87,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern.ts(90,10): error TS2488: Type '(string | string[])[]' must have a '[Symbol.iterator]()' method that returns an iterator. !!! error TS2318: Cannot find global type 'Iterable'. -==== sourceMapValidationDestructuringForArrayBindingPattern.ts (30 errors) ==== +==== sourceMapValidationDestructuringForArrayBindingPattern.ts (0 errors) ==== declare var console: { log(msg: any): void; } @@ -51,137 +21,77 @@ sourceMapValidationDestructuringForArrayBindingPattern.ts(90,10): error TS2488: } for (let [, nameA] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA); } for (let [, nameA] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA); } for (let [, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA); } for (let [, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(primarySkillA); } for (let [, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(primarySkillA); } for (let [, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(primarySkillA); } for (let [numberB] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberB); } for (let [numberB] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberB); } for (let [numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberB); } for (let [nameB] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameB); } for (let [nameB] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameB); } for (let [nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameB); } for (let [numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA2); } for (let [numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA2); } for (let [numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameA2); } for (let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameMA); } for (let [nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameMA); } for (let [nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(nameMA); } for (let [numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberA3); } for (let [numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberA3); } for (let [numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(numberA3); } for (let [...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(multiRobotAInfo); } for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(multiRobotAInfo); } for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '(string | string[])[]' must have a '[Symbol.iterator]()' method that returns an iterator. console.log(multiRobotAInfo); } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).types index 949a68a88c27e..c204f45b43ddf 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern(target=es2015).types @@ -929,8 +929,8 @@ for (let [...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ } for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { ->multiRobotAInfo : any[] -> : ^^^^^ +>multiRobotAInfo : (string | string[])[] +> : ^^^^^^^^^^^^^^^^^^^^^ >["trimmer", ["trimming", "edging"]] : (string | string[])[] > : ^^^^^^^^^^^^^^^^^^^^^ >"trimmer" : "trimmer" @@ -965,6 +965,6 @@ for (let [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->multiRobotAInfo : any[] -> : ^^^^^ +>multiRobotAInfo : (string | string[])[] +> : ^^^^^^^^^^^^^^^^^^^^^ } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).errors.txt deleted file mode 100644 index 66e276e3f47d2..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).errors.txt +++ /dev/null @@ -1,191 +0,0 @@ -sourceMapValidationDestructuringForArrayBindingPattern2.ts(24,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(27,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(30,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(33,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(33,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(36,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(36,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(39,6): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(39,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(43,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(46,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(49,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(52,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(55,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(58,6): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(62,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(65,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(68,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(71,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(71,15): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(74,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(74,15): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(77,6): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(77,15): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(81,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(84,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(87,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(90,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(93,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPattern2.ts(96,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForArrayBindingPattern2.ts (30 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - function getRobot() { - return robotA; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - function getMultiRobot() { - return multiRobotA; - } - - let nameA: string, primarySkillA: string, secondarySkillA: string; - let numberB: number, nameB: string; - let numberA2: number, nameA2: string, skillA2: string, nameMA: string; - let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; - let i: number; - - for ([, nameA] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for ([numberB] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([nameB] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).types index c733380fafd7c..4e98942c92a10 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -953,8 +952,8 @@ for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robotA : Robot @@ -997,8 +996,8 @@ for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobot() : Robot @@ -1043,8 +1042,8 @@ for ([numberA3, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1 > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[2, "trimmer", "trimming"] : Robot @@ -1093,8 +1092,8 @@ for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) { > : ^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -1135,8 +1134,8 @@ for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) { > : ^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >getMultiRobot() : MultiSkilledRobot @@ -1179,8 +1178,8 @@ for ([...multiRobotAInfo] = ["trimmer", ["trimming", "edging" > : ^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >["trimmer", ["trimming", "edging"]] : MultiSkilledRobot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).errors.txt deleted file mode 100644 index 0b21e6917534e..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).errors.txt +++ /dev/null @@ -1,234 +0,0 @@ -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(18,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(21,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(24,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(27,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(27,13): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(33,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(33,13): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(39,10): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(39,13): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(46,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(49,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(52,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(55,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(58,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(61,10): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(65,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(68,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(71,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(75,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(76,9): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(83,10): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(84,5): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(91,10): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(92,5): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(100,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(103,10): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts(106,10): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForArrayBindingPatternDefaultValues.ts (27 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, string[]]; - - let robotA: Robot = [1, "mower", "mowing"]; - function getRobot() { - return robotA; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - function getMultiRobot() { - return multiRobotA; - } - - for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for (let [numberB = -1] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let - [nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = getMultiRobot(), i = 0; i < 1; i++) { - ~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).types index 8e969e4a1403a..f20d3304689be 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).errors.txt deleted file mode 100644 index e254a77d2841c..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).errors.txt +++ /dev/null @@ -1,240 +0,0 @@ -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(24,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(27,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(30,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(33,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(33,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(39,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(39,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(45,6): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(45,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(52,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(55,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(58,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(61,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(64,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(67,6): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(71,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(74,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(77,6): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(81,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(82,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(89,6): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(90,5): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(97,6): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(98,5): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(106,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(109,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts(112,6): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2.ts (27 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - function getRobot() { - return robotA; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - function getMultiRobot() { - return multiRobotA; - } - - let nameA: string, primarySkillA: string, secondarySkillA: string; - let numberB: number, nameB: string; - let numberA2: number, nameA2: string, skillA2: string, nameMA: string; - let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; - let i: number; - - for ([, nameA = "name"] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA = "name"] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [ - ~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for ([numberB = -1] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB = -1] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([nameB = "name"] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let - [nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = multiRobotA, i = 0; i < 1; i++) { - ~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = getMultiRobot(), i = 0; i < 1; i++) { - ~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA = "noName", - ~~~~~~~~~~~~~~~~~~~ - [ - ~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["none", "none"] - ~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) { - ~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).types index f290800163181..e52ddba83cbc6 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPatternDefaultValues2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -1181,8 +1180,8 @@ for ([numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) { > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robotA : Robot @@ -1231,8 +1230,8 @@ for ([numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) { > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobot() : Robot @@ -1283,8 +1282,8 @@ for ([numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[2, "trimmer", "trimming"] : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).errors.txt deleted file mode 100644 index 249eeff845316..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).errors.txt +++ /dev/null @@ -1,170 +0,0 @@ -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(21,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(24,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(27,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(30,50): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(33,50): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(36,50): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(40,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(43,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(46,23): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(49,21): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(52,21): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(55,21): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(59,41): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(62,41): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(65,41): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(68,56): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(71,56): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(74,56): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(78,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(81,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(84,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(87,34): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(90,34): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern.ts(93,34): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfArrayBindingPattern.ts (24 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - let robotB: Robot = [2, "trimmer", "trimming"]; - let robots = [robotA, robotB]; - function getRobots() { - return robots; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - let multiRobots = [multiRobotA, multiRobotB]; - function getMultiRobots() { - return multiRobots; - } - - for (let [, nameA] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for (let [numberB] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [nameB] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for (let [numberA2, nameA2, skillA2] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2, nameA2, skillA2] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for (let [numberA3, ...robotAInfo] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3, ...robotAInfo] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [...multiRobotAInfo] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for (let [...multiRobotAInfo] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).types index 36bec98b662fd..cca716efa5480 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -112,8 +111,8 @@ function getMultiRobots() { for (let [, nameA] of robots) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -126,14 +125,14 @@ for (let [, nameA] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, nameA] of getRobots()) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -148,14 +147,14 @@ for (let [, nameA] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, nameA] of [robotA, robotB]) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >[robotA, robotB] : Robot[] > : ^^^^^^^ >robotA : Robot @@ -172,16 +171,16 @@ for (let [, nameA] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { > : undefined > : ^^^^^^^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >multiRobots : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ @@ -194,16 +193,16 @@ for (let [, [primarySkillA, secondarySkillA]] of multiRobots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { > : undefined > : ^^^^^^^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >getMultiRobots() : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >getMultiRobots : () => MultiSkilledRobot[] @@ -218,16 +217,16 @@ for (let [, [primarySkillA, secondarySkillA]] of getMultiRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { > : undefined > : ^^^^^^^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -244,13 +243,13 @@ for (let [, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [numberB] of robots) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -263,12 +262,12 @@ for (let [numberB] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [numberB] of getRobots()) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -283,12 +282,12 @@ for (let [numberB] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [numberB] of [robotA, robotB]) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >[robotA, robotB] : Robot[] > : ^^^^^^^ >robotA : Robot @@ -305,12 +304,12 @@ for (let [numberB] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [nameB] of multiRobots) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >multiRobots : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ @@ -323,12 +322,12 @@ for (let [nameB] of multiRobots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [nameB] of getMultiRobots()) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >getMultiRobots() : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >getMultiRobots : () => MultiSkilledRobot[] @@ -343,12 +342,12 @@ for (let [nameB] of getMultiRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [nameB] of [multiRobotA, multiRobotB]) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -365,17 +364,17 @@ for (let [nameB] of [multiRobotA, multiRobotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [numberA2, nameA2, skillA2] of robots) { ->numberA2 : any -> : ^^^ ->nameA2 : any -> : ^^^ ->skillA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ +>nameA2 : string +> : ^^^^^^ +>skillA2 : string +> : ^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -388,16 +387,16 @@ for (let [numberA2, nameA2, skillA2] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [numberA2, nameA2, skillA2] of getRobots()) { ->numberA2 : any -> : ^^^ ->nameA2 : any -> : ^^^ ->skillA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ +>nameA2 : string +> : ^^^^^^ +>skillA2 : string +> : ^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -412,16 +411,16 @@ for (let [numberA2, nameA2, skillA2] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { ->numberA2 : any -> : ^^^ ->nameA2 : any -> : ^^^ ->skillA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ +>nameA2 : string +> : ^^^^^^ +>skillA2 : string +> : ^^^^^^ >[robotA, robotB] : Robot[] > : ^^^^^^^ >robotA : Robot @@ -438,16 +437,16 @@ for (let [numberA2, nameA2, skillA2] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { ->nameMA : any -> : ^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >multiRobots : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ @@ -460,16 +459,16 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { ->nameMA : any -> : ^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >getMultiRobots() : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >getMultiRobots : () => MultiSkilledRobot[] @@ -484,16 +483,16 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { ->nameMA : any -> : ^^^ ->primarySkillA : any -> : ^^^ ->secondarySkillA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ +>primarySkillA : string +> : ^^^^^^ +>secondarySkillA : string +> : ^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -510,15 +509,15 @@ for (let [nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [numberA3, ...robotAInfo] of robots) { ->numberA3 : any -> : ^^^ ->robotAInfo : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -531,14 +530,14 @@ for (let [numberA3, ...robotAInfo] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } for (let [numberA3, ...robotAInfo] of getRobots()) { ->numberA3 : any -> : ^^^ ->robotAInfo : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -553,14 +552,14 @@ for (let [numberA3, ...robotAInfo] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { ->numberA3 : any -> : ^^^ ->robotAInfo : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >[robotA, robotB] : Robot[] > : ^^^^^^^ >robotA : Robot @@ -577,12 +576,12 @@ for (let [numberA3, ...robotAInfo] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } for (let [...multiRobotAInfo] of multiRobots) { ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobots : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ @@ -595,12 +594,12 @@ for (let [...multiRobotAInfo] of multiRobots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ } for (let [...multiRobotAInfo] of getMultiRobots()) { ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >getMultiRobots() : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >getMultiRobots : () => MultiSkilledRobot[] @@ -615,12 +614,12 @@ for (let [...multiRobotAInfo] of getMultiRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ } for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] > : ^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -637,6 +636,6 @@ for (let [...multiRobotAInfo] of [multiRobotA, multiRobotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->multiRobotAInfo : any -> : ^^^ +>multiRobotAInfo : [string, [string, string]] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).errors.txt deleted file mode 100644 index dcd48641cb015..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).errors.txt +++ /dev/null @@ -1,175 +0,0 @@ -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(26,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(29,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(32,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(35,46): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(38,46): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(41,46): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(45,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(48,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(51,19): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(54,17): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(57,17): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(60,17): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(64,37): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(67,37): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(70,37): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(73,52): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(76,52): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(79,52): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(83,35): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(86,35): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(89,35): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(92,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(95,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPattern2.ts(98,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfArrayBindingPattern2.ts (24 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - let robotB: Robot = [2, "trimmer", "trimming"]; - let robots = [robotA, robotB]; - function getRobots() { - return robots; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - let multiRobots = [multiRobotA, multiRobotB]; - function getMultiRobots() { - return multiRobots; - } - - let nameA: string, primarySkillA: string, secondarySkillA: string; - let numberB: number, nameB: string; - let numberA2: number, nameA2: string, skillA2: string, nameMA: string; - let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; - - for ([, nameA] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, [primarySkillA, secondarySkillA]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [primarySkillA, secondarySkillA]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for ([numberB] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([nameB] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for ([numberA2, nameA2, skillA2] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2, nameA2, skillA2] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2, nameA2, skillA2] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([nameMA, [primarySkillA, secondarySkillA]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA, [primarySkillA, secondarySkillA]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA, [primarySkillA, secondarySkillA]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for ([numberA3, ...robotAInfo] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3, ...robotAInfo] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3, ...robotAInfo] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([...multiRobotAInfo] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for ([...multiRobotAInfo] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).types index 4ac8b39d33406..8cfff566e87b2 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPattern2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -599,8 +598,8 @@ for ([numberA3, ...robotAInfo] of robots) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robots : Robot[] @@ -623,8 +622,8 @@ for ([numberA3, ...robotAInfo] of getRobots()) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobots() : Robot[] @@ -649,8 +648,8 @@ for ([numberA3, ...robotAInfo] of [robotA, robotB]) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberA3 : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[robotA, robotB] : Robot[] @@ -675,8 +674,8 @@ for ([numberA3, ...robotAInfo] of [robotA, robotB]) { for ([...multiRobotAInfo] of multiRobots) { >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobots : MultiSkilledRobot[] @@ -697,8 +696,8 @@ for ([...multiRobotAInfo] of multiRobots) { for ([...multiRobotAInfo] of getMultiRobots()) { >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >getMultiRobots() : MultiSkilledRobot[] @@ -721,8 +720,8 @@ for ([...multiRobotAInfo] of getMultiRobots()) { for ([...multiRobotAInfo] of [multiRobotA, multiRobotB]) { >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).errors.txt deleted file mode 100644 index e20ec66dda192..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).errors.txt +++ /dev/null @@ -1,170 +0,0 @@ -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(21,34): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(24,34): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(27,34): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(33,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(39,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(45,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(49,28): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(52,28): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(55,28): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(58,32): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(61,32): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(64,32): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(68,67): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(71,67): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(74,67): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(80,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(86,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(92,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(96,44): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(99,44): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts(102,44): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues.ts (21 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - let robotB: Robot = [2, "trimmer", "trimming"]; - let robots = [robotA, robotB]; - function getRobots() { - return robots; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - let multiRobots = [multiRobotA, multiRobotB]; - function getMultiRobots() { - return multiRobots; - } - - for (let [, nameA = "noName"] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA = "noName"] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, nameA = "noName"] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let [, [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for (let [, [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for (let [numberB = -1] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB = -1] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [numberB = -1] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for (let [nameB = "noName"] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB = "noName"] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for (let [nameMA = "noName", [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA = "noName", [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for (let [nameMA = "noName", [ - primarySkillA = "primary", - secondarySkillA = "secondary" - ] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for (let [numberA3 = -1, ...robotAInfo] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).types index d276bda82c7ea..c932fd489b889 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -112,8 +111,8 @@ function getMultiRobots() { for (let [, nameA = "noName"] of robots) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >robots : Robot[] @@ -128,14 +127,14 @@ for (let [, nameA = "noName"] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, nameA = "noName"] of getRobots()) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >getRobots() : Robot[] @@ -152,14 +151,14 @@ for (let [, nameA = "noName"] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, nameA = "noName"] of [robotA, robotB]) { > : undefined > : ^^^^^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >[robotA, robotB] : Robot[] @@ -178,22 +177,22 @@ for (let [, nameA = "noName"] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let [, [ > : undefined > : ^^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -216,22 +215,22 @@ for (let [, [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [, [ > : undefined > : ^^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -256,22 +255,22 @@ for (let [, [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [, [ > : undefined > : ^^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -298,13 +297,13 @@ for (let [, [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ } for (let [numberB = -1] of robots) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 @@ -321,12 +320,12 @@ for (let [numberB = -1] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [numberB = -1] of getRobots()) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 @@ -345,12 +344,12 @@ for (let [numberB = -1] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [numberB = -1] of [robotA, robotB]) { ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 @@ -371,12 +370,12 @@ for (let [numberB = -1] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberB : any -> : ^^^ +>numberB : number +> : ^^^^^^ } for (let [nameB = "noName"] of multiRobots) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >multiRobots : MultiSkilledRobot[] @@ -391,12 +390,12 @@ for (let [nameB = "noName"] of multiRobots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [nameB = "noName"] of getMultiRobots()) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >getMultiRobots() : MultiSkilledRobot[] @@ -413,12 +412,12 @@ for (let [nameB = "noName"] of getMultiRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >[multiRobotA, multiRobotB] : MultiSkilledRobot[] @@ -437,23 +436,23 @@ for (let [nameB = "noName"] of [multiRobotA, multiRobotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameB : any -> : ^^^ +>nameB : string +> : ^^^^^^ } for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { ->numberA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ ->skillA2 : any -> : ^^^ +>skillA2 : string +> : ^^^^^^ >"skill" : "skill" > : ^^^^^^^ >robots : Robot[] @@ -468,22 +467,22 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { ->numberA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ ->skillA2 : any -> : ^^^ +>skillA2 : string +> : ^^^^^^ >"skill" : "skill" > : ^^^^^^^ >getRobots() : Robot[] @@ -500,22 +499,22 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { ->numberA2 : any -> : ^^^ +>numberA2 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ ->skillA2 : any -> : ^^^ +>skillA2 : string +> : ^^^^^^ >"skill" : "skill" > : ^^^^^^^ >[robotA, robotB] : Robot[] @@ -534,24 +533,24 @@ for (let [numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robot > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA2 : any -> : ^^^ +>nameA2 : string +> : ^^^^^^ } for (let [nameMA = "noName", [ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -574,24 +573,24 @@ for (let [nameMA = "noName", [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [nameMA = "noName", [ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -616,24 +615,24 @@ for (let [nameMA = "noName", [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [nameMA = "noName", [ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ primarySkillA = "primary", ->primarySkillA : any -> : ^^^ +>primarySkillA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondarySkillA = "secondary" ->secondarySkillA : any -> : ^^^ +>secondarySkillA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -660,19 +659,19 @@ for (let [nameMA = "noName", [ > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameMA : any -> : ^^^ +>nameMA : string +> : ^^^^^^ } for (let [numberA3 = -1, ...robotAInfo] of robots) { ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->robotAInfo : any -> : ^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -685,18 +684,18 @@ for (let [numberA3 = -1, ...robotAInfo] of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->robotAInfo : any -> : ^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -711,18 +710,18 @@ for (let [numberA3 = -1, ...robotAInfo] of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ >-1 : -1 > : ^^ >1 : 1 > : ^ ->robotAInfo : any -> : ^^^ +>robotAInfo : [string, string] +> : ^^^^^^^^^^^^^^^^ >[robotA, robotB] : Robot[] > : ^^^^^^^ >robotA : Robot @@ -739,6 +738,6 @@ for (let [numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->numberA3 : any -> : ^^^ +>numberA3 : number +> : ^^^^^^ } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).errors.txt deleted file mode 100644 index 22bb53683fb18..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).errors.txt +++ /dev/null @@ -1,211 +0,0 @@ -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(26,30): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(29,30): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(32,30): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(35,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(38,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(41,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(44,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(47,9): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(50,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(54,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(57,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(60,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(63,28): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(66,28): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(69,28): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(73,63): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(76,63): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(79,63): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(82,26): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(85,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(88,26): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(91,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(94,26): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(97,30): error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(101,40): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(104,40): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts(107,40): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2.ts (27 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - let robotA: Robot = [1, "mower", "mowing"]; - let robotB: Robot = [2, "trimmer", "trimming"]; - let robots = [robotA, robotB]; - function getRobots() { - return robots; - } - - let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - let multiRobots = [multiRobotA, multiRobotB]; - function getMultiRobots() { - return multiRobots; - } - - let nameA: string, primarySkillA: string, secondarySkillA: string; - let numberB: number, nameB: string; - let numberA2: number, nameA2: string, skillA2: string, nameMA: string; - let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[]; - - for ([, nameA = "noName"] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA = "noName"] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, nameA = "noName"] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ([, [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of multiRobots) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of getMultiRobots()) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - for ([, [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primarySkillA); - } - - for ([numberB = -1] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB = -1] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([numberB = -1] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - for ([nameB = "noName"] of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB = "noName"] of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - for ([nameB = "noName"] of [multiRobotA, multiRobotB]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameB); - } - - for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([numberA2 = -1, nameA2 = "noName", skillA2 = "skill"] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - for ([nameMA = "noName", [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of multiRobots) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA = "noName", [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of getMultiRobots()) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - for ([nameMA = "noName", [ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["skill1", "skill2"]] of [multiRobotA, multiRobotB]) { - ~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - for ([numberA3 = -1, ...robotAInfo] of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3 = -1, ...robotAInfo] of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } - for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberA3); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).types index 1c319e262fe08..0659af5e1a0f5 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfArrayBindingPatternDefaultValues2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -833,8 +832,8 @@ for ([numberA3 = -1, ...robotAInfo] of robots) { > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robots : Robot[] @@ -863,8 +862,8 @@ for ([numberA3 = -1, ...robotAInfo] of getRobots()) { > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobots() : Robot[] @@ -895,8 +894,8 @@ for ([numberA3 = -1, ...robotAInfo] of [robotA, robotB]) { > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[robotA, robotB] : Robot[] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).errors.txt deleted file mode 100644 index 56ad17c4d5471..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).errors.txt +++ /dev/null @@ -1,108 +0,0 @@ -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(29,28): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(32,28): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(35,28): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(38,70): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(41,70): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(44,70): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(49,43): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(52,43): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(55,43): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(58,82): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(61,82): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern.ts(64,82): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfObjectBindingPattern.ts (12 errors) ==== - declare var console: { - log(msg: any): void; - } - interface Robot { - name: string; - skill: string; - } - - interface MultiRobot { - name: string; - skills: { - primary: string; - secondary: string; - }; - } - - let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; - let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; - - function getRobots() { - return robots; - } - - function getMultiRobots() { - return multiRobots; - } - - for (let {name: nameA } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - - for (let {name: nameA, skill: skillA } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA, skill: skillA } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).symbols index 8d6365895a9e1..b375c7ebe84be 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).symbols +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).symbols @@ -73,6 +73,7 @@ function getMultiRobots() { } for (let {name: nameA } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 28, 10)) >robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) @@ -83,6 +84,7 @@ for (let {name: nameA } of robots) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 28, 10)) } for (let {name: nameA } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 31, 10)) >getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 79)) @@ -93,6 +95,7 @@ for (let {name: nameA } of getRobots()) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 31, 10)) } for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 29)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 10)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 29)) >skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 44)) @@ -106,7 +109,10 @@ for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 34, 10)) } for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 39)) >multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) @@ -117,7 +123,10 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 37, 20)) } for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 39)) >getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 22, 1)) @@ -128,7 +137,10 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRob >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 40, 20)) } for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 86)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 96)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 115)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 39)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 71)) >skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 43, 86)) @@ -149,7 +161,9 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "m } for (let {name: nameA, skill: skillA } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 4, 17)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 22)) >robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 16, 3)) @@ -160,7 +174,9 @@ for (let {name: nameA, skill: skillA } of robots) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 48, 10)) } for (let {name: nameA, skill: skillA } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 4, 17)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 22)) >getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 18, 79)) @@ -171,7 +187,9 @@ for (let {name: nameA, skill: skillA } of getRobots()) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 51, 10)) } for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 44)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 10)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 59)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 22)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 44)) >skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 59)) @@ -185,8 +203,12 @@ for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 54, 10)) } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 8, 22)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 51)) >multiRobots : Symbol(multiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 17, 3)) @@ -197,8 +219,12 @@ for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 57, 10)) } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 8, 22)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 10)) +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 11, 24)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 51)) >getMultiRobots : Symbol(getMultiRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 22, 1)) @@ -209,8 +235,12 @@ for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 60, 10)) } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 83)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 10)) +>skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 98)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 108)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 32)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 127)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 51)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 83)) >skills : Symbol(skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPattern.ts, 63, 98)) diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).types index 4159a7847a086..ed48a298e5bba 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } interface Robot { name: string; @@ -132,8 +131,8 @@ function getMultiRobots() { for (let {name: nameA } of robots) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -146,14 +145,14 @@ for (let {name: nameA } of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA } of getRobots()) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -168,14 +167,14 @@ for (let {name: nameA } of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ name: "mower", skill: "mowing" } : { name: string; skill: string; } @@ -208,20 +207,20 @@ for (let {name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >multiRobots : MultiRobot[] > : ^^^^^^^^^^^^ @@ -234,20 +233,20 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of multiRobots > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >getMultiRobots() : MultiRobot[] > : ^^^^^^^^^^^^ >getMultiRobots : () => MultiRobot[] @@ -262,20 +261,20 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of getMultiRob > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } @@ -326,19 +325,19 @@ for (let { skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "m > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let {name: nameA, skill: skillA } of robots) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >robots : Robot[] > : ^^^^^^^ @@ -351,18 +350,18 @@ for (let {name: nameA, skill: skillA } of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA, skill: skillA } of getRobots()) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >getRobots() : Robot[] > : ^^^^^^^ >getRobots : () => Robot[] @@ -377,18 +376,18 @@ for (let {name: nameA, skill: skillA } of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ name: "mower", skill: "mowing" } : { name: string; skill: string; } @@ -421,24 +420,24 @@ for (let {name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >multiRobots : MultiRobot[] > : ^^^^^^^^^^^^ @@ -451,24 +450,24 @@ for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >getMultiRobots() : MultiRobot[] > : ^^^^^^^^^^^^ >getMultiRobots : () => MultiRobot[] @@ -483,24 +482,24 @@ for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >[{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }] : { name: string; skills: { primary: string; secondary: string; }; }[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ name: "mower", skills: { primary: "mowing", secondary: "none" } } : { name: string; skills: { primary: string; secondary: string; }; } @@ -551,6 +550,6 @@ for (let {name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).errors.txt deleted file mode 100644 index 382eaa3fc92a0..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).errors.txt +++ /dev/null @@ -1,188 +0,0 @@ -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(32,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(35,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(38,24): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(41,66): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(44,66): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(47,66): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(51,17): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(54,17): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(57,17): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(60,44): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(63,44): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(66,44): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(72,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(75,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(78,39): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(81,78): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(84,78): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(87,78): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(91,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(94,24): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(97,24): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(100,49): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(103,49): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPattern2.ts(106,49): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfObjectBindingPattern2.ts (24 errors) ==== - declare var console: { - log(msg: any): void; - } - interface Robot { - name: string; - skill: string; - } - - interface MultiRobot { - name: string; - skills: { - primary: string; - secondary: string; - }; - } - - let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; - let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; - - function getRobots() { - return robots; - } - - function getMultiRobots() { - return multiRobots; - } - - let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; - let name: string, primary: string, secondary: string, skill: string; - - for ({name: nameA } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({name } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ skills: { primary, secondary } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary, secondary } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - - - for ({name: nameA, skill: skillA } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA, skill: skillA } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA, skill: skillA } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA, skills: { primary: primaryA, secondary: secondaryA } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skill } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skill } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skill } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skills: { primary, secondary } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skills: { primary, secondary } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name, skills: { primary, secondary } } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).types index c373b97104869..63c5d399ef3d1 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPattern2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } interface Robot { name: string; diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).errors.txt deleted file mode 100644 index b135d4b8e4c01..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).errors.txt +++ /dev/null @@ -1,130 +0,0 @@ -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(29,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(32,39): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(35,39): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(39,55): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(43,55): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(48,5): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(53,66): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(56,67): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(59,67): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(68,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(77,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts(86,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts (12 errors) ==== - declare var console: { - log(msg: any): void; - } - interface Robot { - name: string; - skill: string; - } - - interface MultiRobot { - name: string; - skills: { - primary?: string; - secondary?: string; - }; - } - - let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; - let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; - - function getRobots() { - return robots; - } - - function getMultiRobots() { - return multiRobots; - } - - for (let {name: nameA = "noName" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA = "noName" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of - [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - - for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let { - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let { - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for (let { - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).symbols b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).symbols index 833ed42d24557..b5890f9d52123 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).symbols +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).symbols @@ -73,6 +73,7 @@ function getMultiRobots() { } for (let {name: nameA = "noName" } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 28, 10)) >robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) @@ -83,6 +84,7 @@ for (let {name: nameA = "noName" } of robots) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 28, 10)) } for (let {name: nameA = "noName" } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 31, 10)) >getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 79)) @@ -93,6 +95,7 @@ for (let {name: nameA = "noName" } of getRobots()) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 31, 10)) } for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 40)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 10)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 40)) >skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 55)) @@ -106,7 +109,10 @@ for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { nam >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 34, 10)) } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 51)) { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { @@ -121,7 +127,10 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 37, 20)) } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 51)) { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { @@ -136,7 +145,10 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 41, 20)) } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 45, 20)) +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 45, 51)) { primary: "nosKill", secondary: "noSkill" } } of @@ -164,7 +176,9 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 4, 17)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 33)) >robots : Symbol(robots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 16, 3)) @@ -175,7 +189,9 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 52, 10)) } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { +>name : Symbol(Robot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 3, 17)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 10)) +>skill : Symbol(Robot.skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 4, 17)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 33)) >getRobots : Symbol(getRobots, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 18, 79)) @@ -186,7 +202,9 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 55, 10)) } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { +>name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 68)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 10)) +>skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 83)) >skillA : Symbol(skillA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 33)) >name : Symbol(name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 68)) >skill : Symbol(skill, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 58, 83)) @@ -201,13 +219,18 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mowe } for (let { name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 61, 10)) skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 63, 13)) secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 64, 38)) } = { primary: "noSkill", secondary: "noSkill" } @@ -225,13 +248,18 @@ for (let { } for (let { name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 70, 10)) skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 72, 13)) secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 73, 38)) } = { primary: "noSkill", secondary: "noSkill" } @@ -249,13 +277,18 @@ for (let { } for (let { name: nameA = "noName", +>name : Symbol(MultiRobot.name, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 8, 22)) >nameA : Symbol(nameA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 79, 10)) skills: { +>skills : Symbol(MultiRobot.skills, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 9, 17)) + primary: primaryA = "primary", +>primary : Symbol(primary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 10, 13)) >primaryA : Symbol(primaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 81, 13)) secondary: secondaryA = "secondary" +>secondary : Symbol(secondary, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 11, 25)) >secondaryA : Symbol(secondaryA, Decl(sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues.ts, 82, 38)) } = { primary: "noSkill", secondary: "noSkill" } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).types index f7d4e71bdb81e..6b340234e2806 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } interface Robot { name: string; @@ -132,8 +131,8 @@ function getMultiRobots() { for (let {name: nameA = "noName" } of robots) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >robots : Robot[] @@ -148,14 +147,14 @@ for (let {name: nameA = "noName" } of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA = "noName" } of getRobots()) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >getRobots() : Robot[] @@ -172,14 +171,14 @@ for (let {name: nameA = "noName" } of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] @@ -214,22 +213,22 @@ for (let {name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { nam > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -256,22 +255,22 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -300,22 +299,22 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = >skills : any > : ^^^ >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -384,21 +383,21 @@ for (let { skills: { primary: primaryA = "primary", secondary: secondaryA = "sec > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >"noSkill" : "noSkill" > : ^^^^^^^^^ >robots : Robot[] @@ -413,20 +412,20 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of robots) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >"noSkill" : "noSkill" > : ^^^^^^^^^ >getRobots() : Robot[] @@ -443,20 +442,20 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ >skill : any > : ^^^ ->skillA : any -> : ^^^ +>skillA : string +> : ^^^^^^ >"noSkill" : "noSkill" > : ^^^^^^^^^ >[{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }] : { name: string; skill: string; }[] @@ -491,15 +490,15 @@ for (let {name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mowe > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let { name: nameA = "noName", >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ @@ -510,16 +509,16 @@ for (let { primary: primaryA = "primary", >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondary: secondaryA = "secondary" >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -548,15 +547,15 @@ for (let { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let { name: nameA = "noName", >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ @@ -567,16 +566,16 @@ for (let { primary: primaryA = "primary", >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondary: secondaryA = "secondary" >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -607,15 +606,15 @@ for (let { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } for (let { name: nameA = "noName", >name : any > : ^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ >"noName" : "noName" > : ^^^^^^^^ @@ -626,16 +625,16 @@ for (let { primary: primaryA = "primary", >primary : any > : ^^^ ->primaryA : any -> : ^^^ +>primaryA : string +> : ^^^^^^ >"primary" : "primary" > : ^^^^^^^^^ secondary: secondaryA = "secondary" >secondary : any > : ^^^ ->secondaryA : any -> : ^^^ +>secondaryA : string +> : ^^^^^^ >"secondary" : "secondary" > : ^^^^^^^^^^^ @@ -704,6 +703,6 @@ for (let { > : ^^^^^^ ^^ ^^^ ^^^ >log : (msg: any) => void > : ^ ^^ ^^^^^ ->nameA : any -> : ^^^ +>nameA : string +> : ^^^^^^ } diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).errors.txt deleted file mode 100644 index 2796444e1021e..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).errors.txt +++ /dev/null @@ -1,245 +0,0 @@ -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(32,35): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(35,35): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(38,35): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(42,55): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(46,55): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(51,5): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(56,29): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(59,29): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(62,29): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(70,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(78,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(86,6): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(92,62): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(95,63): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(98,63): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(107,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(116,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(125,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(130,49): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(133,49): error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(136,49): error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(145,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(154,6): error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts(163,6): error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2.ts (24 errors) ==== - declare var console: { - log(msg: any): void; - } - interface Robot { - name: string; - skill: string; - } - - interface MultiRobot { - name: string; - skills: { - primary: string; - secondary: string; - }; - } - - let robots: Robot[] = [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]; - let multiRobots: MultiRobot[] = [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]; - - function getRobots() { - return robots; - } - - function getMultiRobots() { - return multiRobots; - } - - let nameA: string, primaryA: string, secondaryA: string, i: number, skillA: string; - let name: string, primary: string, secondary: string, skill: string; - - for ({name: nameA = "noName" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA = "noName" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ skills: { primary: primaryA = "primary", secondary: secondaryA = "secondary" } = - { primary: "nosKill", secondary: "noSkill" } } of - [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - - for ({ name = "noName" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ name = "noName" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ name = "noName" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - for ({ - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(primaryA); - } - - - for ({name: nameA = "noName", skill: skillA = "noSkill" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA = "noName", skill: skillA = "noSkill" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({name: nameA = "noName", skill: skillA = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name: nameA = "noName", - skills: { - primary: primaryA = "primary", - secondary: secondaryA = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - - for ({ name = "noName", skill = "noSkill" } of robots) { - ~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ name = "noName", skill = "noSkill" } of getRobots()) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'Robot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ name = "noName", skill = "noSkill" } of [{ name: "mower", skill: "mowing" }, { name: "trimmer", skill: "trimming" }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skill: string; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name = "noName", - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of multiRobots) { - ~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name = "noName", - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of getMultiRobots()) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiRobot[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - for ({ - name = "noName", - skills: { - primary = "primary", - secondary = "secondary" - } = { primary: "noSkill", secondary: "noSkill" } - } of [{ name: "mower", skills: { primary: "mowing", secondary: "none" } }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - { name: "trimmer", skills: { primary: "trimming", secondary: "edging" } }]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '{ name: string; skills: { primary: string; secondary: string; }; }[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).types index 29a674352710f..61071a5da110c 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringForOfObjectBindingPatternDefaultValues2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } interface Robot { name: string; diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).errors.txt deleted file mode 100644 index 25520ce430f39..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).errors.txt +++ /dev/null @@ -1,48 +0,0 @@ -sourceMapValidationDestructuringParametertArrayBindingPattern.ts(7,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern.ts(11,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern.ts(15,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern.ts(19,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringParametertArrayBindingPattern.ts (4 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - var robotA: Robot = [1, "mower", "mowing"]; - - function foo1([, nameA]: Robot) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - - function foo2([numberB]: Robot) { - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - - function foo3([numberA2, nameA2, skillA2]: Robot) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - - function foo4([numberA3, ...robotAInfo]: Robot) { - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(robotAInfo); - } - - foo1(robotA); - foo1([2, "trimmer", "trimming"]); - - foo2(robotA); - foo2([2, "trimmer", "trimming"]); - - foo3(robotA); - foo3([2, "trimmer", "trimming"]); - - foo4(robotA); - foo4([2, "trimmer", "trimming"]); \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).types index 5b0be15036f95..52edb6fd0a0ab 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).errors.txt deleted file mode 100644 index f93daae24661b..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -sourceMapValidationDestructuringParametertArrayBindingPattern2.ts(7,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern2.ts(11,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern2.ts(15,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern2.ts(15,24): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPattern2.ts(19,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringParametertArrayBindingPattern2.ts (5 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [string, [string, string]]; - var robotA: Robot = ["trimmer", ["trimming", "edging"]]; - - function foo1([, skillA]: Robot) { - ~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(skillA); - } - - function foo2([nameMB]: Robot) { - ~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMB); - } - - function foo3([nameMA, [primarySkillA, secondarySkillA]]: Robot) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - function foo4([...multiRobotAInfo]: Robot) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(multiRobotAInfo); - } - - foo1(robotA); - foo1(["roomba", ["vacuum", "mopping"]]); - - foo2(robotA); - foo2(["roomba", ["vacuum", "mopping"]]); - - foo3(robotA); - foo3(["roomba", ["vacuum", "mopping"]]); - - foo4(robotA); - foo4(["roomba", ["vacuum", "mopping"]]); \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).types index 26afa5bf44e09..4de0b5be5819c 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPattern2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [string, [string, string]]; >Robot : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).errors.txt deleted file mode 100644 index 75607a4d2e0d6..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).errors.txt +++ /dev/null @@ -1,48 +0,0 @@ -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts(7,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts(11,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts(15,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts(19,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues.ts (4 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - var robotA: Robot = [1, "mower", "mowing"]; - - function foo1([, nameA = "noName"]: Robot = [-1, "name", "skill"]) { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA); - } - - function foo2([numberB = -1]: Robot = [-1, "name", "skill"]) { - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(numberB); - } - - function foo3([numberA2 = -1, nameA2 = "name", skillA2 = "skill"]: Robot = [-1, "name", "skill"]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameA2); - } - - function foo4([numberA3 = -1, ...robotAInfo]: Robot = [-1, "name", "skill"]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(robotAInfo); - } - - foo1(robotA); - foo1([2, "trimmer", "trimming"]); - - foo2(robotA); - foo2([2, "trimmer", "trimming"]); - - foo3(robotA); - foo3([2, "trimmer", "trimming"]); - - foo4(robotA); - foo4([2, "trimmer", "trimming"]); \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).types index e47e6d3aebab5..8f83f04f17c7a 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).errors.txt deleted file mode 100644 index 904032782d4a2..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).errors.txt +++ /dev/null @@ -1,50 +0,0 @@ -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts(7,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts(11,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts(15,15): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts(15,35): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2.ts (4 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [string, string[]]; - var robotA: Robot = ["trimmer", ["trimming", "edging"]]; - - function foo1([, skillA = ["noSkill", "noSkill"]]: Robot= ["name", ["skill1", "skill2"]]) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(skillA); - } - - function foo2([nameMB = "noName"]: Robot = ["name", ["skill1", "skill2"]]) { - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMB); - } - - function foo3([nameMA = "noName", [ - ~~~~~~~~~~~~~~~~~~~~~ - ~ - primarySkillA = "primary", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - secondarySkillA = "secondary" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ] = ["noSkill", "noSkill"]]: Robot) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - console.log(nameMA); - } - - foo1(robotA); - foo1(["roomba", ["vacuum", "mopping"]]); - - foo2(robotA); - foo2(["roomba", ["vacuum", "mopping"]]); - - foo3(robotA); - foo3(["roomba", ["vacuum", "mopping"]]); \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).types index f0b4b1b92ab80..9fb722f961905 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringParametertArrayBindingPatternDefaultValues2(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [string, string[]]; >Robot : Robot diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern(target=es2015).errors.txt deleted file mode 100644 index f984dcd4967e1..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern(target=es2015).errors.txt +++ /dev/null @@ -1,41 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(9,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(10,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(11,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(13,5): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(14,5): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts(16,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPattern.ts (6 errors) ==== - declare var console: { - log(msg: string): void; - } - type Robot = [number, string, string]; - var robotA: Robot = [1, "mower", "mowing"]; - var robotB: Robot = [2, "trimmer", "trimming"]; - - - let [, nameA] = robotA; - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberB] = robotB; - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberA2, nameA2, skillA2] = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [numberC2] = [3, "edging", "Trimming edges"]; - ~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberC, nameC, skillC] = [3, "edging", "Trimming edges"]; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [numberA3, ...robotAInfo] = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameA == nameA2) { - console.log(skillA2); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2(target=es2015).errors.txt deleted file mode 100644 index 70255fc07f1a3..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern2(target=es2015).errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(8,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(9,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(10,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(10,14): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(12,5): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(13,5): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(13,15): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts(15,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPattern2.ts (8 errors) ==== - declare var console: { - log(msg: string): void; - } - type MultiSkilledRobot = [string, [string, string]]; - var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - - let [, skillA] = multiRobotA; - ~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMB] = multiRobotB; - ~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMA, [primarySkillA, secondarySkillA]] = multiRobotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [nameMC] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMC2, [primarySkillC, secondarySkillC]] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [...multiRobotAInfo] = multiRobotA; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameMB == nameMA) { - console.log(skillA[0] + skillA[1]); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).errors.txt deleted file mode 100644 index a83cc60024d9e..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).errors.txt +++ /dev/null @@ -1,140 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(18,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(19,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(20,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(21,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(22,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(23,1): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(25,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(26,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(27,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(28,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(29,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(30,1): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(32,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(33,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(34,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(35,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(35,10): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(36,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(36,10): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(37,1): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(37,10): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(39,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(40,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(41,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(42,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(43,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts(44,1): error TS2488: Type '(string | [string, string])[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPattern3.ts (27 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, [string, string]]; - - var robotA: Robot = [1, "mower", "mowing"]; - var robotB: Robot = [2, "trimmer", "trimming"]; - var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - - let nameA: string, numberB: number, nameB: string, skillB: string; - let robotAInfo: (number | string)[]; - - let multiSkillB: [string, string], nameMB: string, primarySkillB: string, secondarySkillB: string; - let multiRobotAInfo: (string | [string, string])[]; - - [, nameA] = robotA; - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, nameB] = getRobotB(); - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, nameB] = [2, "trimmer", "trimming"]; - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB] = multiRobotB; - ~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB] = getMultiRobotB(); - ~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - - [numberB] = robotB; - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB] = getRobotB(); - ~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB] = [2, "trimmer", "trimming"]; - ~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB] = multiRobotB; - ~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB] = getMultiRobotB(); - ~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB] = ["trimmer", ["trimming", "edging"]]; - ~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - - [numberB, nameB, skillB] = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB, nameB, skillB] = getRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB, nameB, skillB] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB, [primarySkillB, secondarySkillB]] = multiRobotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB, [primarySkillB, secondarySkillB]] = getMultiRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB, [primarySkillB, secondarySkillB]] = ["trimmer", ["trimming", "edging"]]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - [numberB, ...robotAInfo] = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB, ...robotAInfo] = getRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB, ...robotAInfo] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [...multiRobotAInfo] = multiRobotA; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [...multiRobotAInfo] = getMultiRobotB(); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [...multiRobotAInfo] = ["trimmer", ["trimming", "edging"]]; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '(string | [string, string])[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameA == nameB) { - console.log(skillB); - } - - function getRobotB() { - return robotB; - } - - function getMultiRobotB() { - return multiRobotB; - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).types index 86eddb3db4c75..362eee3615e45 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPattern3(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -382,8 +381,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberB : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robotB : Robot @@ -396,8 +395,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberB : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobotB() : Robot @@ -412,8 +411,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >numberB : number > : ^^^^^^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[2, "trimmer", "trimming"] : Robot @@ -432,8 +431,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotA : MultiSkilledRobot @@ -444,8 +443,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >getMultiRobotB() : MultiSkilledRobot @@ -458,8 +457,8 @@ let multiRobotAInfo: (string | [string, string])[]; > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >[...multiRobotAInfo] : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->...multiRobotAInfo : any -> : ^^^ +>...multiRobotAInfo : string | [string, string] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ >multiRobotAInfo : (string | [string, string])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >["trimmer", ["trimming", "edging"]] : (string | [string, string])[] diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues(target=es2015).errors.txt deleted file mode 100644 index f5e130b5a0f9c..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues(target=es2015).errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(8,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(9,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(10,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(12,5): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(13,5): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts(15,5): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues.ts (6 errors) ==== - declare var console: { - log(msg: string): void; - } - type Robot = [number, string, string]; - var robotA: Robot = [1, "mower", "mowing"]; - var robotB: Robot = [2, "trimmer", "trimming"]; - - let [, nameA = "noName"] = robotA; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberB = -1] = robotB; - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberA2 = -1, nameA2 = "noName", skillA2 = "noSkill"] = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [numberC2 = -1] = [3, "edging", "Trimming edges"]; - ~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - let [numberC = -1, nameC = "noName", skillC = "noSkill"] = [3, "edging", "Trimming edges"]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [numberA3 = -1, ...robotAInfo] = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameA == nameA2) { - console.log(skillA2); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2(target=es2015).errors.txt deleted file mode 100644 index 80a9d1647c869..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2(target=es2015).errors.txt +++ /dev/null @@ -1,41 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(8,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(9,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(10,5): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(10,25): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(12,5): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(13,5): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts(13,26): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues2.ts (7 errors) ==== - declare var console: { - log(msg: string): void; - } - type MultiSkilledRobot = [string, string[]]; - var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - - let [, skillA = ["noSkill", "noSkill"]] = multiRobotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMB = "noName" ] = multiRobotB; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMA = "noName", [primarySkillA = "noSkill", secondarySkillA = "noSkill"] = ["noSkill", "noSkill"]] = multiRobotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - let [nameMC = "noName" ] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - let [nameMC2 = "noName", [primarySkillC = "noSkill", secondarySkillC = "noSkill"] = ["noSkill", "noSkill"]] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameMB == nameMA) { - console.log(skillA[0] + skillA[1]); - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).errors.txt b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).errors.txt deleted file mode 100644 index 22f0dc8343e7b..0000000000000 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).errors.txt +++ /dev/null @@ -1,138 +0,0 @@ -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(18,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(19,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(20,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(21,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(22,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(23,1): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(25,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(26,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(27,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(28,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(29,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(30,1): error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(32,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(33,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(34,1): error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(35,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(35,26): error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(35,26): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(36,1): error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(36,26): error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(36,26): error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(37,1): error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(37,26): error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(37,26): error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(40,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(41,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. -sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts(42,1): error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3.ts (27 errors) ==== - declare var console: { - log(msg: any): void; - } - type Robot = [number, string, string]; - type MultiSkilledRobot = [string, string[]]; - - var robotA: Robot = [1, "mower", "mowing"]; - var robotB: Robot = [2, "trimmer", "trimming"]; - var multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]]; - var multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]]; - - let nameA: string, numberB: number, nameB: string, skillB: string; - let robotAInfo: (number | string)[]; - - let multiSkillB: string[], nameMB: string, primarySkillB: string, secondarySkillB: string; - let multiRobotAInfo: (string | string[])[]; - - [, nameA = "helloNoName"] = robotA; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, nameB = "helloNoName"] = getRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, nameB = "helloNoName"] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB = []] = multiRobotB; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB = []] = getMultiRobotB(); - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [, multiSkillB = []] = ["roomba", ["vacuum", "mopping"]]; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - - [numberB = -1] = robotB; - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1] = getRobotB(); - ~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName"] = multiRobotB; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName"] = getMultiRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName"] = ["trimmer", ["trimming", "edging"]]; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string[]]' must have a '[Symbol.iterator]()' method that returns an iterator. - - [numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = getRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1, nameB = "helloNoName", skillB = "noSkill"] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[number, string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = multiRobotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = getMultiRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'MultiSkilledRobot' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'string[]' must have a '[Symbol.iterator]()' method that returns an iterator. - [nameMB = "helloNoName", [primarySkillB = "noSkill", secondarySkillB = "noSkill"] = []] = - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, [string, string]]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[]' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type '[string, string]' must have a '[Symbol.iterator]()' method that returns an iterator. - ["trimmer", ["trimming", "edging"]]; - - [numberB = -1, ...robotAInfo] = robotB; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1, ...robotAInfo] = getRobotB(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - [numberB = -1, ...robotAInfo] = [2, "trimmer", "trimming"]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'Robot' must have a '[Symbol.iterator]()' method that returns an iterator. - - if (nameA == nameB) { - console.log(skillB); - } - - function getRobotB() { - return robotB; - } - - function getMultiRobotB() { - return multiRobotB; - } \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).types b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).types index c92d878e97649..b319dffea433d 100644 --- a/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).types +++ b/tests/baselines/reference/sourceMapValidationDestructuringVariableStatementArrayBindingPatternDefaultValues3(target=es2015).types @@ -9,7 +9,6 @@ declare var console: { >log : (msg: any) => void > : ^ ^^ ^^^^^ >msg : any -> : ^^^ } type Robot = [number, string, string]; >Robot : Robot @@ -534,8 +533,8 @@ let multiRobotAInfo: (string | string[])[]; > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >robotB : Robot @@ -554,8 +553,8 @@ let multiRobotAInfo: (string | string[])[]; > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >getRobotB() : Robot @@ -576,8 +575,8 @@ let multiRobotAInfo: (string | string[])[]; > : ^^ >1 : 1 > : ^ ->...robotAInfo : any -> : ^^^ +>...robotAInfo : string | number +> : ^^^^^^^^^^^^^^^ >robotAInfo : (string | number)[] > : ^^^^^^^^^^^^^^^^^^^ >[2, "trimmer", "trimming"] : Robot diff --git a/tests/baselines/reference/types.forAwait.es2018.3.errors.txt b/tests/baselines/reference/types.forAwait.es2018.3.errors.txt index 545dbdb69e2e3..803cc4ddb932c 100644 --- a/tests/baselines/reference/types.forAwait.es2018.3.errors.txt +++ b/tests/baselines/reference/types.forAwait.es2018.3.errors.txt @@ -1,8 +1,8 @@ error TS2318: Cannot find global type 'AsyncIterableIterator'. -types.forAwait.es2018.3.ts(3,27): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. -types.forAwait.es2018.3.ts(5,21): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. -types.forAwait.es2018.3.ts(10,27): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. -types.forAwait.es2018.3.ts(12,21): error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +types.forAwait.es2018.3.ts(3,27): error TS2495: Type '{}' is not an array type or a string type. +types.forAwait.es2018.3.ts(5,21): error TS2495: Type '{}' is not an array type or a string type. +types.forAwait.es2018.3.ts(10,27): error TS2495: Type '{}' is not an array type or a string type. +types.forAwait.es2018.3.ts(12,21): error TS2495: Type '{}' is not an array type or a string type. !!! error TS2318: Cannot find global type 'AsyncIterableIterator'. @@ -11,22 +11,22 @@ types.forAwait.es2018.3.ts(12,21): error TS2504: Type '{}' must have a '[Symbol. let y: number; for await (const x of {}) { ~~ -!!! error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +!!! error TS2495: Type '{}' is not an array type or a string type. } for await (y of {}) { ~~ -!!! error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +!!! error TS2495: Type '{}' is not an array type or a string type. } } async function* f2() { let y: number; for await (const x of {}) { ~~ -!!! error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +!!! error TS2495: Type '{}' is not an array type or a string type. } for await (y of {}) { ~~ -!!! error TS2504: Type '{}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. +!!! error TS2495: Type '{}' is not an array type or a string type. } } \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).errors.txt b/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).errors.txt deleted file mode 100644 index 29baa9866f372..0000000000000 --- a/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -useObjectValuesAndEntries1.ts(3,15): error TS2488: Type 'number[]' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== useObjectValuesAndEntries1.ts (1 errors) ==== - var o = { a: 1, b: 2 }; - - for (var x of Object.values(o)) { - ~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'number[]' must have a '[Symbol.iterator]()' method that returns an iterator. - let y = x; - } - - var entries = Object.entries(o); // [string, number][] - var values = Object.values(o); // number[] - - var entries1 = Object.entries(1); // [string, any][] - var values1 = Object.values(1); // any[] - - var entries2 = Object.entries({ a: true, b: 2 }); // [string, number|boolean][] - var values2 = Object.values({ a: true, b: 2 }); // (number|boolean)[] - - var entries3 = Object.entries({}); // [string, {}][] - var values3 = Object.values({}); // {}[] - - var a = ["a", "b", "c"]; - var entries4 = Object.entries(a); // [string, string][] - var values4 = Object.values(a); // string[] - - enum E { A, B } - var entries5 = Object.entries(E); // [string, any][] - var values5 = Object.values(E); // any[] - - interface I { } - var i: I = {}; - var entries6 = Object.entries(i); // [string, any][] - var values6 = Object.values(i); // any[] \ No newline at end of file diff --git a/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).types b/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).types index 3e1ae362fe15e..5056e95ab3900 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).types +++ b/tests/baselines/reference/useObjectValuesAndEntries1(target=es2015).types @@ -16,8 +16,8 @@ var o = { a: 1, b: 2 }; > : ^ for (var x of Object.values(o)) { ->x : any -> : ^^^ +>x : number +> : ^^^^^^ >Object.values(o) : number[] > : ^^^^^^^^ >Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } @@ -30,10 +30,10 @@ for (var x of Object.values(o)) { > : ^^^^^^^^^^^^^^^^^^^^^^^^^ let y = x; ->y : any -> : ^^^ ->x : any -> : ^^^ +>y : number +> : ^^^^^^ +>x : number +> : ^^^^^^ } var entries = Object.entries(o); // [string, number][] diff --git a/tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts b/tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts new file mode 100644 index 0000000000000..ee25dced9afd6 --- /dev/null +++ b/tests/cases/compiler/arrayIterationLibES5TargetDifferent.ts @@ -0,0 +1,28 @@ +// @strict: true +// @lib: es5 +// @noLib: true,false +// @target: es5,es2015,esnext + +declare function log(message?: any): void; + +for (const x of [1, 2, 3]) { + log(x); +} + +declare const aString: string; + +for (const x of aString) { + log(x); +} + +declare const aNumber: number; + +for (const x of aNumber) { + log(x); +} + +declare const anObject: { foo: string }; + +for (const x of anObject) { + log(x); +} \ No newline at end of file From 6c2c564554a9f521c55e2aad0f9624ad1db29b4d Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:27:06 -0800 Subject: [PATCH 2/3] Revert isArrayLikeType --- src/compiler/checker.ts | 6 +----- ...rgetDifferent(nolib=true,target=es2015).errors.txt | 11 +---------- ...5TargetDifferent(nolib=true,target=es5).errors.txt | 11 +---------- ...rgetDifferent(nolib=true,target=esnext).errors.txt | 11 +---------- tests/baselines/reference/noCrashOnNoLib.errors.txt | 5 +---- 5 files changed, 5 insertions(+), 39 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2065cc496d848..41ff21e4f9855 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -25480,11 +25480,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function isArrayLikeType(type: Type): boolean { // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, - // or if it is not the undefined or null type and if it is assignable to ReadonlyArray. - // When Array doesn't exist (noLib), we can't determine array-likeness. - if (anyReadonlyArrayType === emptyObjectType) { - return false; - } + // or if it is not the undefined or null type and if it is assignable to ReadonlyArray return isArrayType(type) || !(type.flags & TypeFlags.Nullable) && isTypeAssignableTo(type, anyReadonlyArrayType); } diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt index 481b7447ceb37..c37bcb476dec3 100644 --- a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es2015).errors.txt @@ -9,9 +9,6 @@ error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. error TS5053: Option 'lib' cannot be specified with option 'noLib'. -arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. !!! error TS2318: Cannot find global type 'Array'. @@ -25,12 +22,10 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. !!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. -==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== +==== arrayIterationLibES5TargetDifferent.ts (0 errors) ==== declare function log(message?: any): void; for (const x of [1, 2, 3]) { - ~~~~~~~~~ -!!! error TS2495: Type '{}' is not an array type or a string type. log(x); } @@ -43,15 +38,11 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string declare const aNumber: number; for (const x of aNumber) { - ~~~~~~~ -!!! error TS2495: Type 'number' is not an array type or a string type. log(x); } declare const anObject: { foo: string }; for (const x of anObject) { - ~~~~~~~~ -!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. log(x); } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt index 481b7447ceb37..c37bcb476dec3 100644 --- a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=es5).errors.txt @@ -9,9 +9,6 @@ error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. error TS5053: Option 'lib' cannot be specified with option 'noLib'. -arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. !!! error TS2318: Cannot find global type 'Array'. @@ -25,12 +22,10 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. !!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. -==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== +==== arrayIterationLibES5TargetDifferent.ts (0 errors) ==== declare function log(message?: any): void; for (const x of [1, 2, 3]) { - ~~~~~~~~~ -!!! error TS2495: Type '{}' is not an array type or a string type. log(x); } @@ -43,15 +38,11 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string declare const aNumber: number; for (const x of aNumber) { - ~~~~~~~ -!!! error TS2495: Type 'number' is not an array type or a string type. log(x); } declare const anObject: { foo: string }; for (const x of anObject) { - ~~~~~~~~ -!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. log(x); } \ No newline at end of file diff --git a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt index 481b7447ceb37..c37bcb476dec3 100644 --- a/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt +++ b/tests/baselines/reference/arrayIterationLibES5TargetDifferent(nolib=true,target=esnext).errors.txt @@ -9,9 +9,6 @@ error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. error TS5053: Option 'lib' cannot be specified with option 'noLib'. -arrayIterationLibES5TargetDifferent.ts(3,17): error TS2495: Type '{}' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(15,17): error TS2495: Type 'number' is not an array type or a string type. -arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string; }' is not an array type or a string type. !!! error TS2318: Cannot find global type 'Array'. @@ -25,12 +22,10 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. !!! error TS5053: Option 'lib' cannot be specified with option 'noLib'. -==== arrayIterationLibES5TargetDifferent.ts (3 errors) ==== +==== arrayIterationLibES5TargetDifferent.ts (0 errors) ==== declare function log(message?: any): void; for (const x of [1, 2, 3]) { - ~~~~~~~~~ -!!! error TS2495: Type '{}' is not an array type or a string type. log(x); } @@ -43,15 +38,11 @@ arrayIterationLibES5TargetDifferent.ts(21,17): error TS2495: Type '{ foo: string declare const aNumber: number; for (const x of aNumber) { - ~~~~~~~ -!!! error TS2495: Type 'number' is not an array type or a string type. log(x); } declare const anObject: { foo: string }; for (const x of anObject) { - ~~~~~~~~ -!!! error TS2495: Type '{ foo: string; }' is not an array type or a string type. log(x); } \ No newline at end of file diff --git a/tests/baselines/reference/noCrashOnNoLib.errors.txt b/tests/baselines/reference/noCrashOnNoLib.errors.txt index bc1da7fe28b9a..e8c7885ffadc3 100644 --- a/tests/baselines/reference/noCrashOnNoLib.errors.txt +++ b/tests/baselines/reference/noCrashOnNoLib.errors.txt @@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'. error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. -noCrashOnNoLib.ts(4,15): error TS2461: Type '{}' is not an array type. !!! error TS2318: Cannot find global type 'Array'. @@ -17,12 +16,10 @@ noCrashOnNoLib.ts(4,15): error TS2461: Type '{}' is not an array type. !!! error TS2318: Cannot find global type 'Object'. !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. -==== noCrashOnNoLib.ts (1 errors) ==== +==== noCrashOnNoLib.ts (0 errors) ==== export function f() { let e: {}[] = []; while (true) { e = [...(e || [])]; - ~~~~~~~~~ -!!! error TS2461: Type '{}' is not an array type. } } \ No newline at end of file From 673c49644933b812bdfed8774eef18eb6e5e859b Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 30 Jan 2026 14:28:15 -0800 Subject: [PATCH 3/3] Go away, comment --- src/compiler/checker.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 41ff21e4f9855..04abe7d1b45ce 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45620,7 +45620,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const iterableExists = getGlobalIterableType(/*reportErrors*/ false) !== emptyGenericType; - // Only use iteration semantics when Iterable exists; otherwise fall through to array-like handling. const uplevelIteration = languageVersion >= ScriptTarget.ES2015 && iterableExists; const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & IterationUse.PossiblyOutOfBounds);