constructor() {
    this._settled = false;
    this._promise = new Promise((resolve, reject) => {
      this._resolve = (resolve: any);
      this._reject = (reject: any);
    });
  }
Deferred provides a Promise-like API that exposes methods to resolve and
reject the Promise. It is most useful when converting non-Promise code to use
Promises.

If you want to export the Promise without exposing access to the resolve and
reject methods, you should export `getPromise` which returns a Promise with
the same semantics excluding those methods.