Local variable refinements are unsafe in TS and Flow. Both are bad, TS is the worst. Seems obvious in hindsight but neither handle local refinement invalidation correctly. I'm not speaking abstractly, this has caused bugs in my code before.
-
Show this thread
-
Replying to @sebmck
The real problem is that the "safe" assumption (if you can't see a function body, assume it changes everything) is also the one most likely to be wrong in practice -- function bodies you can't see *almost never* change locally-visible data
2 replies 0 retweets 2 likes -
Replying to @SeaRyanC
Dunno, I've found that TypeScript is way too loose. I never personally found a problem with refinment invalidation when writing code with Flow but I'm a masochistic and am fine writing weird code.
1 reply 0 retweets 1 like
This is another case I ran into which I'm pretty sure is in the same class as refinement invalidation: https://www.typescriptlang.org/play/#code/MYGwhgzhAEBiD29oG8BQ1rHgOwgFwCcBXYPeAgCgEoV0No8ALASwgDoxTmA3AU2gC80AGZgQEXgG46AX1R1OeHrwBc0AEaIQvMNml0AJjq7cweXtVr0GLdouWCRYidIxy6zbMzyW01pqwcJvxChERS8v62bEb2pubU+tYA9MnQsSZmFjQSeNAABgF2wfkMSPmi4ryl6kR53gDkMPjMICDQALZgBADWvAbQkAVh1enhZTb8kBDMAObYHbzYeWCafHQYzMLQFEVBSnyCAkKVEjR+1pg4EPDabCDwsxQNRB0dDVSu9HJuqDJAA …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 