Flow at least invalidates refinements when calling local functions that mutate variables, but does not follow any indirection https://flow.org/try/#0PQKgBAAgZgNg9gdzAZwC4CcCWBjVYTABQhMApngG4CGMAXGAHYCuAtgEanpgA+KGmDAOZgAvGADk4gNzEoTBrkxwGYKsmSZBDAJIMAJpnSlFygBQBKMAG9CYVes0MAcqw7oLMgL6z5JlWo0tF3ZOC2tbMGoYUTAAJi8fBVQlFRYqATCbO0woMFNUAE8AB1I4XKjRETFxZhD0cUssuzBUAAt0REZSJABRdA73cSc4RldOZFUYeARSPQaZO28I4GAwbVy2zAmENTAAAwDHYLc9ltbSFQAxabAEOCYYPTBsOH7jVBgCsAEozD0qVCkM5AoxQASkFgXVARQ5aXQGIx+DzEOwrMAAFVaWxQrXujzAUHSMAANN9UOIJlRRnUIqYovQ0FghOYvEA …
-
-
Show this thread
-
TS won't ever invalidate local refinements in this case, even when it can easily statically tell that a function call will https://www.typescriptlang.org/play/#code/DYUwLgBAbghsBcEB2BXAtgIxAJwgHwgGcxsBLJAcwgF4IByOgbgChmAzFJAYzFIHskEGIUKkKSAHLos2ABQBKCAG9mEaHBoQATCwC+rDt14CIaGOQXLVEUmwiywATwAOIPndjAa1WnVSYcOkUVNTUwAAtsPgB3ZBBYgFFsKLk6CT5kaRxCIWBgGJAAEyCWNX1rAHoKiAARATpIJBAioSRHGyRC0mwQHn5BcJwQa2FRcSkAuXkWSuqAFXDSHMJwvhRgQog2c2AAGhswOhyYTMnrLgFiIhJEYjJKTU89IA …
Show this thread
End of conversation
New conversation -
-
-
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
-
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 more reply
New conversation -
-
-
Basically just let’s use react proptypes and make sure how the data is coming and going from/to the backend. Have real control over your types by yourself. Man I don’t like TS
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Could you please explain what you mean by "local variable refinements"?
-
The examples included in my follow up tweets clarify. I should have said "closed-over variables" apparently:https://twitter.com/sompylasar/status/1146529893301116928 …
- 3 more replies
New conversation -
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 