We recently ran into some breaks in #43004 (comment) as a result of #25330; however, I think this might be a bigger change than we anticipate.
For one, we don't check whether the value is used after checking the value. For another, we don't really think about class properties, which aren't reliable unless using strictPropertyInitialization.
// @strictNullChecks: true// @strictPropertyInitialization: falseclassC{yadda: Promise<number>;asyncdoStuff(){this.yadda=Promise.resolve(42);}}asyncfunctionf(){letobj=newC();if(obj.yadda){awaitobj.yadda;}letx=newC().yadda;if(x){awaitx;}}Finally, there's some sort of bug where this is plainly giving false positives.
letx: Promise<string>;setTimeout(()=>{x=Promise.resolve("");})setTimeout(()=>{// this should NOT be an errorif(x){x;}})I guess the question is: should these be errors?
We recently ran into some breaks in #43004 (comment) as a result of #25330; however, I think this might be a bigger change than we anticipate.
For one, we don't check whether the value is used after checking the value. For another, we don't really think about class properties, which aren't reliable unless using
strictPropertyInitialization.Finally, there's some sort of bug where this is plainly giving false positives.
I guess the question is: should these be errors?