#Why is this telling me it's a problem when accessing static property/function from a type?

4 messages · Page 1 of 1 (latest)

vagrant bronze
#

Sorry for the screenshot, I can't reproduce the error in TS Playground.

Why is this a problem, but if I wrap the if statement in a function and call that it's fine?

waxen jewel
#

Because functions don't contribute to control flow analysis, so code within the function doesn't affect the inferred type

#

!:9998 is related-ish, there's probably some issue linked deep within that conversation that's similar to this

brittle shaleBOT