mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix crash in rest element destructuring
This commit is contained in:
parent
5bfbcdcd25
commit
e6ffb33adf
@ -7633,7 +7633,7 @@ module ts {
|
||||
// This elementType will be used if the specific property corresponding to this index is not
|
||||
// present (aka the tuple element property). This call also checks that the parentType is in
|
||||
// fact an iterable or array (depending on target language).
|
||||
let elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false);
|
||||
let elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType;
|
||||
let elements = node.elements;
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
let e = elements[i];
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/assignmentRestElementWithErrorSourceType.ts(2,5): error TS2304: Cannot find name 'c'.
|
||||
tests/cases/compiler/assignmentRestElementWithErrorSourceType.ts(2,10): error TS2304: Cannot find name 'tupel'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentRestElementWithErrorSourceType.ts (2 errors) ====
|
||||
var tuple: [string, number];
|
||||
[...c] = tupel; // intentionally misspelled
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'c'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'tupel'.
|
||||
@ -0,0 +1,7 @@
|
||||
//// [assignmentRestElementWithErrorSourceType.ts]
|
||||
var tuple: [string, number];
|
||||
[...c] = tupel; // intentionally misspelled
|
||||
|
||||
//// [assignmentRestElementWithErrorSourceType.js]
|
||||
var tuple;
|
||||
c = tupel.slice(0); // intentionally misspelled
|
||||
@ -0,0 +1,2 @@
|
||||
var tuple: [string, number];
|
||||
[...c] = tupel; // intentionally misspelled
|
||||
Loading…
x
Reference in New Issue
Block a user