97 lines
7.6 KiB
Plaintext
97 lines
7.6 KiB
Plaintext
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 });
|
|
}
|
|
|