File: es6MemberScoping.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (21 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
tests/cases/compiler/es6MemberScoping.ts(7,21): error TS2301: Initializer of instance member variable '_store' cannot reference identifier 'store' declared in the constructor.


==== tests/cases/compiler/es6MemberScoping.ts (1 errors) ====
    class Foo {
        constructor(store: string) { }
    
        public foo() {
            return this._store.length; 
        }
        public _store = store; // should be an error.
                        ~~~~~
!!! error TS2301: Initializer of instance member variable '_store' cannot reference identifier 'store' declared in the constructor.
    }
    
    class Foo2 {
     
      static Foo2():number { return 0; } // should not be an error
     
    }