File: thisPropertyAssignment.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (43 lines) | stat: -rw-r--r-- 1,937 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
tests/cases/conformance/salsa/a.js(9,8): error TS2339: Property 'y' does not exist on type '{}'.
tests/cases/conformance/salsa/a.js(11,1): error TS7053: Element implicitly has an 'any' type because expression of type '"z"' can't be used to index type '{}'.
  Property 'z' does not exist on type '{}'.
tests/cases/conformance/salsa/a.js(16,10): error TS2339: Property 'b' does not exist on type '{}'.
tests/cases/conformance/salsa/a.js(18,3): error TS7053: Element implicitly has an 'any' type because expression of type '"c"' can't be used to index type '{}'.
  Property 'c' does not exist on type '{}'.


==== tests/cases/conformance/salsa/a.js (4 errors) ====
    // This test is asserting that a single property/element access
    // on `this` is a special assignment declaration, but chaining
    // off that does not create additional declarations. I’m not sure
    // if it needs to be that way in JavaScript; the test simply
    // ensures no accidental changes were introduced while allowing
    // element access assignments to create declarations.
    
    this.x = {};
    this.x.y = {};
           ~
!!! error TS2339: Property 'y' does not exist on type '{}'.
    this["y"] = {};
    this["y"]["z"] = {};
    ~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"z"' can't be used to index type '{}'.
!!! error TS7053:   Property 'z' does not exist on type '{}'.
    
    /** @constructor */
    function F() {
      this.a = {};
      this.a.b = {};
             ~
!!! error TS2339: Property 'b' does not exist on type '{}'.
      this["b"] = {};
      this["b"]["c"] = {};
      ~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"c"' can't be used to index type '{}'.
!!! error TS7053:   Property 'c' does not exist on type '{}'.
    }
    
    const f = new F();
    f.a;
    f.b;