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
classExample{privateget_foo(){returnMath.random()<0.5 ? "a" : "b";}bar(){if(this._foo==="a"){console.log("got 'a'");// this error should not occur:if(this._foo==="b"){console.log("lucky case, got 'b' too");}}}}classSpan{getend(){returnthis.start+this.length}constructor(publicstart: number,publiclength: number){}}constspan=newSpan(4,2);if(span.end==6){span.length+=1;// same here:if(span.end==7){console.log("worked");}}
π Actual behavior
An error occured because TypeScript thinks this._foo/span.end doesn't change until that if-check, but in these examples it does.
π Expected behavior
There shouldn't be such checks with getters.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
An error occured because TypeScript thinks
this._foo
/span.end
doesn't change until that if-check, but in these examples it does.π Expected behavior
There shouldn't be such checks with getters.
The text was updated successfully, but these errors were encountered: