-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error for missing method call #35557
Comments
It looks like we're confused by any reference to |
The way the check is done for usage seems brittle. The only check that is done is for symbol const functionIsUsedInBody = forEachChild(ifStatement.thenStatement, function check(childNode): boolean | undefined {
if (isIdentifier(childNode)) {
const childSymbol = getSymbolAtLocation(childNode);
if (childSymbol && childSymbol.id === testedFunctionSymbol.id) { // HERE
return true;
}
}
return forEachChild(childNode, check);
}); This has the drawback of not actually working at all for interface StatsBase {
isDirectory(): boolean;
}
function A(stats2: StatsBase, stats: StatsBase) {
if (stats.isDirectory) { // no error because we access isDirectory on stat2
stats2.isDirectory(); // comment this and we get an error above
}
} The symbols Proposed solution:
|
TypeScript Version: 3.8.0-dev.20191206
Search Terms:
Code
Expected behavior:
Error on
isDirectory
. This is a method but it has not been calledActual behavior:
No error reported.
If I remove the console log line
The text was updated successfully, but these errors were encountered: