Closed
Description
TypeScript Version: 3.8.3
Search Terms:
noUnusedLocals, recursive
Code
class C {
private static staticFactorial(n: number): number { // no error
return (n === 0) ? 1 : (n * C.staticFactorial(n - 1));
}
private static foo() { // unused error
return 42;
}
}
function main() {
function localFactorial(n: number): number { // unused error
return (n === 0) ? 1 : (n * localFactorial(n - 1));
}
}
Expected behavior:
both localFactorial
and staticFactorial
have the same result when compiled with --noUnusedLocals
Actual behavior:
localFactorial
triggers error
staticFactorial
does not