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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
=== tests/cases/compiler/unusedLocalsAndParameters.ts ===
export { };
// function declaration paramter
function f(a) {
>f : (a: any) => void
>a : any
}
f(0);
>f(0) : void
>f : (a: any) => void
>0 : 0
// function expression paramter
var fexp = function (a) {
>fexp : (a: any) => void
>function (a) {} : (a: any) => void
>a : any
};
fexp(0);
>fexp(0) : void
>fexp : (a: any) => void
>0 : 0
// arrow function paramter
var farrow = (a) => {
>farrow : (a: any) => void
>(a) => {} : (a: any) => void
>a : any
};
class C {
>C : C
// Method declaration paramter
method(a) {
>method : (a: any) => void
>a : any
}
// Accessor declaration paramter
set x(v: number) {
>x : number
>v : number
}
}
var E = class {
>E : typeof E
>class { // Method declaration paramter method(a) { } // Accessor declaration paramter set x(v: number) { }} : typeof E
// Method declaration paramter
method(a) {
>method : (a: any) => void
>a : any
}
// Accessor declaration paramter
set x(v: number) {
>x : number
>v : number
}
}
var o = {
>o : { method(a: any): void; x: number; }
>{ // Object literal method declaration paramter method(a) { }, // Accessor declaration paramter set x(v: number) { }} : { method(a: any): void; x: number; }
// Object literal method declaration paramter
method(a) {
>method : (a: any) => void
>a : any
},
// Accessor declaration paramter
set x(v: number) {
>x : number
>v : number
}
};
o;
>o : { method(a: any): void; x: number; }
// in a for..in statment
for (let i in o) {
>i : string
>o : { method(a: any): void; x: number; }
}
// in a for..of statment
for (let i of [1, 2, 3]) {
>i : number
>[1, 2, 3] : number[]
>1 : 1
>2 : 2
>3 : 3
}
// in a for. statment
for (let i = 0, n; i < 10; i++) {
>i : number
>0 : 0
>n : any
>i < 10 : boolean
>i : number
>10 : 10
>i++ : number
>i : number
}
// in a block
const condition = false;
>condition : false
>false : false
if (condition) {
>condition : false
const c = 0;
>c : 0
>0 : 0
}
// in try/catch/finally
try {
const a = 0;
>a : 0
>0 : 0
}
catch (e) {
>e : any
const c = 1;
>c : 1
>1 : 1
}
finally {
const c = 0;
>c : 0
>0 : 0
}
// in a namespace
namespace N {
>N : typeof N
var x;
>x : any
}
for (let x: y) {
>x : y
z(x);
>z : any
>(x) : y
>x : y
}
> : any
> : any
|