Closed
Description
Repro
{
"rules": {
"@typescript-eslint/deprecation": ["warn"]
}
}
// CASE 1: for functions
/** @deprecated use f2 instead */
function f1(): void {return;}
function f2(): void {return;}
f1(); // WARN: "f1 is deprecated: use f2 instead
// CASE 2: for interfaces
interface Test {
/** @deprecated use b instead */
public a?: string;
public b?: string;
}
const x: Test = {
a: "foo"; // WARN: "Test.a is deprecated: use b instead
}
Expected Result
In both cases there should be a warning, that the function or property are depricated.
Actual Result
The @depricated
comments are ignored.
Additional Info
There is a TSLint Rule: deprication
and a long discussion at the TypeScript Bugtracker
I did not check the implementation for TSLint, but there are many things to consider. They should be configurable.
- For interfaces a depricated property must be optional (otherwise one could not not use the property)
- There should be a warning if a
private
orprotected
property is marked as depricated. (at least private properties should be updated as soon as a property is depricated) - A
@depricated
tag must be followed by an explanation and/or alternative.