51 lines
No EOL
4.2 KiB
Text
51 lines
No EOL
4.2 KiB
Text
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,17): error TS1187: A parameter property may not be a binding pattern.
|
|
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,27): error TS2459: Type '{ x: number; y: string; z: boolean; }' has no property 'x1' and no string index signature.
|
|
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,31): error TS2459: Type '{ x: number; y: string; z: boolean; }' has no property 'x2' and no string index signature.
|
|
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,35): error TS2459: Type '{ x: number; y: string; z: boolean; }' 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,16): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
|
|
Types of property '0' are incompatible.
|
|
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
|
Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'.
|
|
|
|
|
|
==== 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 a binding pattern.
|
|
~~
|
|
!!! error TS2459: Type '{ x: number; y: string; z: boolean; }' has no property 'x1' and no string index signature.
|
|
~~
|
|
!!! error TS2459: Type '{ x: number; y: string; z: boolean; }' has no property 'x2' and no string index signature.
|
|
~~
|
|
!!! error TS2459: Type '{ x: number; y: string; z: boolean; }' 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 '[{ x: number; y: string; z: boolean; }, number, string]'.
|
|
!!! error TS2345: Types of property '0' are incompatible.
|
|
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
|
!!! error TS2345: Property 'x' is missing in type '{ x1: number; x2: string; x3: boolean; }'.
|
|
var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; |