File: typeFromPropertyAssignment29.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 (125 lines) | stat: -rw-r--r-- 5,600 bytes parent folder | download | duplicates (5)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(60,14): error TS2339: Property 'prop' does not exist on type '(n: number) => string'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(61,14): error TS2339: Property 'm' does not exist on type '(n: number) => string'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(64,22): error TS2339: Property 'prop' does not exist on type '(n: number) => string'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(64,42): error TS2339: Property 'm' does not exist on type '(n: number) => string'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(70,14): error TS2339: Property 'prop' does not exist on type 'typeof ExpandoClass'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(71,14): error TS2339: Property 'm' does not exist on type 'typeof ExpandoClass'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(74,22): error TS2339: Property 'prop' does not exist on type 'typeof ExpandoClass'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(74,42): error TS2339: Property 'm' does not exist on type 'typeof ExpandoClass'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(80,14): error TS2339: Property 'prop' does not exist on type 'typeof ExpandoExpr3'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(81,14): error TS2339: Property 'm' does not exist on type 'typeof ExpandoExpr3'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(84,22): error TS2339: Property 'prop' does not exist on type 'typeof ExpandoExpr3'.
tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts(84,42): error TS2339: Property 'm' does not exist on type 'typeof ExpandoExpr3'.


==== tests/cases/conformance/salsa/typeFromPropertyAssignment29.ts (12 errors) ====
    function ExpandoDecl(n: number) {
        return n.toString();
    }
    ExpandoDecl.prop = 2
    ExpandoDecl.m = function(n: number) {
        return n + 1;
    }
    var n = ExpandoDecl.prop + ExpandoDecl.m(12) + ExpandoDecl(101).length
    
    const ExpandoExpr = function (n: number) {
        return n.toString();
    }
    ExpandoExpr.prop = { x: 2 }
    ExpandoExpr.prop = { y: "" }
    ExpandoExpr.m = function(n: number) {
        return n + 1;
    }
    var n = (ExpandoExpr.prop.x || 0) + ExpandoExpr.m(12) + ExpandoExpr(101).length
    
    const ExpandoArrow = (n: number) => n.toString();
    ExpandoArrow.prop = 2
    ExpandoArrow.m = function(n: number) {
        return n + 1;
    
    }
    
    function ExpandoNested(n: number) {
        const nested = function (m: number) {
            return n + m;
        };
        nested.total = n + 1_000_000;
        return nested;
    }
    ExpandoNested.also = -1;
    
    function ExpandoMerge(n: number) {
        return n * 100;
    }
    ExpandoMerge.p1 = 111
    namespace ExpandoMerge {
        export var p2 = 222;
    }
    namespace ExpandoMerge {
        export var p3 = 333;
    }
    var n = ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge(1);
    
    namespace Ns {
        function ExpandoNamespace(): void {}
        ExpandoNamespace.p6 = 42;
        export function foo() {
            return ExpandoNamespace;
        }
    }
    
    // Should not work in Typescript -- must be const
    var ExpandoExpr2 = function (n: number) {
        return n.toString();
    }
    ExpandoExpr2.prop = 2
                 ~~~~
!!! error TS2339: Property 'prop' does not exist on type '(n: number) => string'.
    ExpandoExpr2.m = function(n: number) {
                 ~
!!! error TS2339: Property 'm' does not exist on type '(n: number) => string'.
        return n + 1;
    }
    var n = ExpandoExpr2.prop + ExpandoExpr2.m(12) + ExpandoExpr2(101).length
                         ~~~~
!!! error TS2339: Property 'prop' does not exist on type '(n: number) => string'.
                                             ~
!!! error TS2339: Property 'm' does not exist on type '(n: number) => string'.
    
    // Should not work in typescript -- classes already have statics
    class ExpandoClass {
        n = 1001;
    }
    ExpandoClass.prop = 2
                 ~~~~
!!! error TS2339: Property 'prop' does not exist on type 'typeof ExpandoClass'.
    ExpandoClass.m = function(n: number) {
                 ~
!!! error TS2339: Property 'm' does not exist on type 'typeof ExpandoClass'.
        return n + 1;
    }
    var n = ExpandoClass.prop + ExpandoClass.m(12) + new ExpandoClass().n
                         ~~~~
!!! error TS2339: Property 'prop' does not exist on type 'typeof ExpandoClass'.
                                             ~
!!! error TS2339: Property 'm' does not exist on type 'typeof ExpandoClass'.
    
    // Class expressions shouldn't work in typescript either
    var ExpandoExpr3 = class {
        n = 10001;
    }
    ExpandoExpr3.prop = 3
                 ~~~~
!!! error TS2339: Property 'prop' does not exist on type 'typeof ExpandoExpr3'.
    ExpandoExpr3.m = function(n: number) {
                 ~
!!! error TS2339: Property 'm' does not exist on type 'typeof ExpandoExpr3'.
        return n + 1;
    }
    var n = ExpandoExpr3.prop + ExpandoExpr3.m(13) + new ExpandoExpr3().n
                         ~~~~
!!! error TS2339: Property 'prop' does not exist on type 'typeof ExpandoExpr3'.
                                             ~
!!! error TS2339: Property 'm' does not exist on type 'typeof ExpandoExpr3'.