File: destructuringParameterProperties1.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 (71 lines) | stat: -rw-r--r-- 4,264 bytes parent folder | download | duplicates (7)
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
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(2,17): error TS1187: A parameter property may not be declared using a binding pattern.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(9,17): error TS1187: A parameter property may not be declared using a binding pattern.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(16,17): error TS1187: A parameter property may not be declared using a binding pattern.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(22,26): error TS2339: Property 'x' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(22,35): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(22,43): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(22,52): error TS2339: Property 'z' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(25,30): error TS2339: Property 'x' does not exist on type 'C2'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(25,36): error TS2339: Property 'y' does not exist on type 'C2'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(25,42): error TS2339: Property 'z' does not exist on type 'C2'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(29,30): error TS2339: Property 'x' does not exist on type 'C3'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(29,36): error TS2339: Property 'y' does not exist on type 'C3'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts(29,42): error TS2339: Property 'z' does not exist on type 'C3'.


==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties1.ts (13 errors) ====
    class C1 {
        constructor(public [x, y, z]: string[]) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1187: A parameter property may not be declared using a binding pattern.
        }
    }
    
    type TupleType1 = [string, number, boolean];
    
    class C2 {
        constructor(public [x, y, z]: TupleType1) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1187: A parameter property may not be declared using a binding pattern.
        }
    }
    
    type ObjType1 = { x: number; y: string; z: boolean }
    
    class C3 {
        constructor(public { x, y, z }: ObjType1) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1187: A parameter property may not be declared using a binding pattern.
        }
    }
    
    var c1 = new C1([]);
    c1 = new C1(["larry", "{curly}", "moe"]);
    var useC1Properties = c1.x === c1.y && c1.y === c1.z;
                             ~
!!! error TS2339: Property 'x' does not exist on type 'C1'.
                                      ~
!!! error TS2339: Property 'y' 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 c2 = new C2(["10", 10, !!10]);
    var [c2_x, c2_y, c2_z] = [c2.x, c2.y, c2.z];
                                 ~
!!! error TS2339: Property 'x' does not exist on type 'C2'.
                                       ~
!!! error TS2339: Property 'y' does not exist on type 'C2'.
                                             ~
!!! error TS2339: Property 'z' does not exist on type 'C2'.
    
    var c3 = new C3({x: 0, y: "", z: false});
    c3 = new C3({x: 0, "y": "y", z: true});
    var [c3_x, c3_y, c3_z] = [c3.x, c3.y, c3.z];
                                 ~
!!! error TS2339: Property 'x' does not exist on type 'C3'.
                                       ~
!!! error TS2339: Property 'y' does not exist on type 'C3'.
                                             ~
!!! error TS2339: Property 'z' does not exist on type 'C3'.