The condition on line 1663 in editorServices.ts:
https://github.com/Microsoft/TypeScript/blob/eef7d8bd3d974528464c7968deab78b747568c06/src/server/editorServices.ts#L1650-L1666
is always false as the called method closeExternalProject always returns void. That way the if-block with shouldRefreshInferredProjects = true; is never executed (for more information see the linter rule detecting this).
See also https://palantir.github.io/tslint/rules/no-void-expression/ -- but this would require us to set up linting with type information.
thanks for the report. a PR would be appreciated.
@mhegazy seems like using a void value in a truthiness position is hyper-sketchy - thoughts on making that an error in TS?
thoughts on making that an error in TS?
i thought you had experimented with this a while back; I think it is a check worth adding, baring any breaks that we might find from RWC tests.
I had a test for always-truthy values that attempted to find bugs like if (x.f) (in lieu of if (x.f()) {) but the problem was that non-strictNullChecks .d.ts file gave tons of false positives. Checking for void values in control flow test positions should be a home run
i think the void check should only flag errors. seems like a low risk-high yield change to make.
Most helpful comment
@mhegazy seems like using a
voidvalue in a truthiness position is hyper-sketchy - thoughts on making that an error in TS?