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
|
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,17): error TS1187: A parameter property may not be declared using a binding pattern.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,27): error TS2459: Type 'ObjType1' has no property 'x1' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,31): error TS2459: Type 'ObjType1' has no property 'x2' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,35): error TS2459: Type 'ObjType1' has no property 'x3' and no string index signature.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,29): error TS2339: Property 'x1' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,40): error TS2339: Property 'x2' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,51): error TS2339: Property 'x3' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,62): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,72): error TS2339: Property 'z' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,19): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[ObjType1, number, string]'.
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type 'ObjType1'.
Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (10 errors) ====
type ObjType1 = { x: number; y: string; z: boolean }
type TupleType1 = [ObjType1, number, string]
class C1 {
constructor(public [{ x1, x2, x3 }, y, z]: TupleType1) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1187: A parameter property may not be declared using a binding pattern.
~~
!!! error TS2459: Type 'ObjType1' has no property 'x1' and no string index signature.
~~
!!! error TS2459: Type 'ObjType1' has no property 'x2' and no string index signature.
~~
!!! error TS2459: Type 'ObjType1' has no property 'x3' and no string index signature.
var foo: any = x1 || x2 || x3 || y || z;
var bar: any = this.x1 || this.x2 || this.x3 || this.y || this.z;
~~
!!! error TS2339: Property 'x1' does not exist on type 'C1'.
~~
!!! error TS2339: Property 'x2' does not exist on type 'C1'.
~~
!!! error TS2339: Property 'x3' does not exist on type 'C1'.
~
!!! error TS2339: Property 'y' does not exist on type 'C1'.
~
!!! error TS2339: Property 'z' does not exist on type 'C1'.
}
}
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
~~~~~~
!!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[ObjType1, number, string]'.
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type 'ObjType1'.
!!! error TS2345: Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z];
|