1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(13,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(14,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(20,17): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(20,23): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(21,25): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(22,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(29,14): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(29,20): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(30,22): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: number; }'.
==== tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts (20 errors) ====
// Missing properties
function f1() {
var { x, y } = {};
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var { x = 1, y } = {};
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
var { x, y = 1 } = {};
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
var { x = 1, y = 1 } = {};
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'.
~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'.
}
// Missing properties
function f2() {
var x: number, y: number;
({ x, y } = {});
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
({ x: x = 1, y } = {});
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
({ x, y: y = 1 } = {});
~
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
({ x: x = 1, y: y = 1 } = {});
}
// Excess properties
function f3() {
var { } = { x: 0, y: 0 };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
var { x } = { x: 0, y: 0 };
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
var { y } = { x: 0, y: 0 };
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
var { x, y } = { x: 0, y: 0 };
}
// Excess properties
function f4() {
var x: number, y: number;
({ } = { x: 0, y: 0 });
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{}'.
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{}'.
({ x } = { x: 0, y: 0 });
~
!!! error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
({ y } = { x: 0, y: 0 });
~
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: number; }'.
({ x, y } = { x: 0, y: 0 });
}
|