3 ms·
Well I can't really see any benefit to force the wrapping all returned values in promises without a proper example. The then() signature can be expressed in ty
by Guillaume86 11y ago
Well I can't really see any benefit to force the wrapping all returned values in promises without a proper example.
The then() signature can be expressed in typescript and I suppose in alternatives like flow (using the union type): https://github.com/borisyankov/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts https://github.com/borisyankov/DefinitelyTyped/blob/master/e... .
- tel 11y agoSure, you can represent it that way, but it needlessly complicates the semantics of `then`. If they were merely monadic bind then it'd easily be 1/20th as confusing. The "overload everything every which way and assume that people are really sensitive to the differences" strategy just begs misunderstanding. Monadic bind as the core and basis of your API is fantastic. It is exactly enough and no more than you need to define effectful sequencing semantics and, if you like, you can build everything atop it. And, honestly, you do anyway. But right now the design obscures the simple basis technology in order to have heaps of overload magic.