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 126 127 128
|
=== tests/cases/compiler/constDeclarations-access2.ts ===
const x = 0
>x : 0
>0 : 0
// Errors
x = 1;
>x = 1 : 1
>x : any
>1 : 1
x += 2;
>x += 2 : any
>x : any
>2 : 2
x -= 3;
>x -= 3 : number
>x : any
>3 : 3
x *= 4;
>x *= 4 : number
>x : any
>4 : 4
x /= 5;
>x /= 5 : number
>x : any
>5 : 5
x %= 6;
>x %= 6 : number
>x : any
>6 : 6
x <<= 7;
>x <<= 7 : number
>x : any
>7 : 7
x >>= 8;
>x >>= 8 : number
>x : any
>8 : 8
x >>>= 9;
>x >>>= 9 : number
>x : any
>9 : 9
x &= 10;
>x &= 10 : number
>x : any
>10 : 10
x |= 11;
>x |= 11 : number
>x : any
>11 : 11
x ^= 12;
>x ^= 12 : number
>x : any
>12 : 12
x++;
>x++ : number
>x : any
x--;
>x-- : number
>x : any
++x;
>++x : number
>x : any
--x;
>--x : number
>x : any
++((x));
>++((x)) : number
>((x)) : any
>(x) : any
>x : any
// OK
var a = x + 1;
>a : number
>x + 1 : number
>x : number
>1 : 1
function f(v: number) { }
>f : (v: number) => void
>v : number
f(x);
>f(x) : void
>f : (v: number) => void
>x : number
if (x) { }
>x : number
x;
>x : number
(x);
>(x) : number
>x : number
-x;
>-x : number
>x : number
+x;
>+x : number
>x : number
x.toString();
>x.toString() : string
>x.toString : (radix?: number) => string
>x : number
>toString : (radix?: number) => string
|