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
|
=== tests/cases/compiler/constDeclarations-errors.ts ===
// error, missing intialicer
const c1;
>c1 : Symbol(c1, Decl(constDeclarations-errors.ts, 1, 5))
const c2: number;
>c2 : Symbol(c2, Decl(constDeclarations-errors.ts, 2, 5))
const c3, c4, c5 :string, c6; // error, missing initialicer
>c3 : Symbol(c3, Decl(constDeclarations-errors.ts, 3, 5))
>c4 : Symbol(c4, Decl(constDeclarations-errors.ts, 3, 9))
>c5 : Symbol(c5, Decl(constDeclarations-errors.ts, 3, 13))
>c6 : Symbol(c6, Decl(constDeclarations-errors.ts, 3, 25))
for(const c in {}) { }
>c : Symbol(c, Decl(constDeclarations-errors.ts, 5, 9))
// error, assigning to a const
for(const c8 = 0; c8 < 1; c8++) { }
>c8 : Symbol(c8, Decl(constDeclarations-errors.ts, 8, 9))
>c8 : Symbol(c8, Decl(constDeclarations-errors.ts, 8, 9))
>c8 : Symbol(c8, Decl(constDeclarations-errors.ts, 8, 9))
// error, can not be unintalized
for(const c9; c9 < 1;) { }
>c9 : Symbol(c9, Decl(constDeclarations-errors.ts, 11, 9))
>c9 : Symbol(c9, Decl(constDeclarations-errors.ts, 11, 9))
// error, can not be unintalized
for(const c10 = 0, c11; c10 < 1;) { }
>c10 : Symbol(c10, Decl(constDeclarations-errors.ts, 14, 9))
>c11 : Symbol(c11, Decl(constDeclarations-errors.ts, 14, 18))
>c10 : Symbol(c10, Decl(constDeclarations-errors.ts, 14, 9))
|