File: destructuringParameterProperties5.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (68 lines) | stat: -rw-r--r-- 5,393 bytes parent folder | download | duplicates (4)
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
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 TS2339: Property 'x1' does not exist on type 'ObjType1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,31): error TS2339: Property 'x2' does not exist on type 'ObjType1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(5,35): error TS2339: Property 'x3' does not exist on type 'ObjType1'.
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 TS2322: Type '{ x1: number; x2: string; x3: true; }' 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(11,47): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,51): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,39): error TS2339: Property 'x1' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,45): error TS2339: Property 'x2' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,51): error TS2339: Property 'x3' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,57): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(12,62): error TS2339: Property 'z' does not exist on type 'C1'.


==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts (17 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 TS2339: Property 'x1' does not exist on type 'ObjType1'.
                                  ~~
!!! error TS2339: Property 'x2' does not exist on type 'ObjType1'.
                                      ~~
!!! error TS2339: Property 'x3' does not exist on type 'ObjType1'.
            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 TS2322: Type '{ x1: number; x2: string; x3: true; }' is not assignable to type 'ObjType1'.
!!! error TS2322:   Object literal may only specify known properties, and 'x1' does not exist in type 'ObjType1'.
                                                  ~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
                                                      ~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
    var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.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'.