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
Problem:
Funtional programming needs better support in TypeScript. Values are everything in FP and in TypeScript the expression statements just silently discard them. Not being able to track places where the values are discarded leads to severe bugs. Example:
// before refactoringfunctionnotify(message: string) : void{window.postMessage(message);// <-- assuming always works}// turns out that window.postMessage crashes when window gets closed// need a check and a conditional result// after refactoringfunctionnotify(message: string) : Tried<void,'cant-send-a-message'>{if(window.closed){returnfailureFrom('cant-send-a-message');}else{returnsuccessFrom(window.postMessage(message));}}// after such change we need to make sure that all places that call `notify` are addressed// it's easy to overlook those without a help from a compiler
Workaround:
use a linter rule
Solution:
add a flag to the compiler
The text was updated successfully, but these errors were encountered:
I would want to bring it up for discussion again, since this is the third request in a few weeks for this feature.
I doubt anything will happen immediately as we do not have any precedence for the attribute/metadata syntax. ambient decorators (#2900) seems like a good candidate, but we do not have these yet.
Uh oh!
There was an error while loading. Please reload this page.
Problem:
Funtional programming needs better support in TypeScript. Values are everything in FP and in TypeScript the expression statements just silently discard them. Not being able to track places where the values are discarded leads to severe bugs. Example:
Workaround:
use a linter rule
Solution:
add a flag to the compiler
The text was updated successfully, but these errors were encountered: