You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Same problem when comparing unknown type with undefined. As says TypeScript documentation, anything (including undefined) is assignable to unknown type, so comparing it with undefined is always correct.
class TestClass {
private readonly myVar: unknown = "Test";
public constructor() {
this.myVar = undefined;
if (this.myVar !== undefined) { // Expression is always true.
}
}
}
Bug Report
TypeScript code being linted
with
tslint.yaml
configuration:Actual behavior
tslint falsely warns that the expression is always true.
Expected behavior
Since the object is of type
unknown
(and actually astring
), the expression could be both true and false and thus tslint should not warn.The text was updated successfully, but these errors were encountered: