canvasMaxAreaInBytes in DocumentInitParameters has type Boolean, preventing TypeScript users from passing the correct (numeric) value.
this._passwordCapability = new PromiseCapability();
      if (loadingTask.onPassword) {
        const updatePassword = password => {
          if (password instanceof Error) {
            this._passwordCapability.reject(password);
          } else {
            this._passwordCapability.resolve({ password });
          }
        };
        try {
          loadingTask.onPassword(updatePassword, exception.code);
        } catch (ex) {
          this._passwordCapability.reject(ex);
        }
      } else {
        this._passwordCapability.reject(
          new PasswordException(exception.message, exception.code)
        );
      }
      return this._passwordCapability.promise;
    });
    messageHandler.on("DataLoaded", data => {
      
      
      loadingTask.onProgress?.({
        loaded: data.length,
        total: data.length,
      });
      this.downloadInfoCapability.resolve(data);
    });