Promises

Promise is another popular term you would have heard before. By definition, "Promise is a future value.", meaning a promise represents a placeholder for the result of a computation, the value of which will be determined at some point in the future. Technically speaking, this value may or may not be made available in the future, implying that the computation may either resolve or reject at some point in the future.

The definition subtleties aside, if you think about it, promises are very similar to callbacks. When we pass a callback to a function, we rely on that function to call the supplied callback at some point in the future. The callback either gets called back with an error or with the result of the operation. Similarly, with ...

Get TypeScript High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.