Question about how to write using 'Promise<Plugin Listener Handle>'

private listener: PluginListenerHandle;

public ngOnInit() {
    if (this.platform.is('hybrid')) {
      this.listener = CodeScanner.addListener('CodeScannerCatchEvent', async (info) => {
        const sku = await this.getItem(parseInt(info.code, 10)).catch(() => undefined);
        if (!sku) {
          return;
        }

        this.pickupItems.push({
          code: sku.skuId,
          amount: null,
          product: sku.skuName,
          price: sku.skuPrice,
          disabled: true,
        });
        this.zone.run(() => {
          setTimeout(() => {
            this.elem.nativeElement.querySelector('.focus-amount_' + (this.pickupItems.length - 1)).setFocus();
          }, 500);
        });
      });
    }
  }
export interface PluginListenerHandle {
    remove: () => Promise<void>;
}

5th line this.listener
[ERROR] TS2741: Property ‘remove’ is missing in type ‘Promise’ but required in type ‘PluginListenerHandle’. [plugin angular-compiler]

What we did to improve

  • this.listener = await CodeScanner.addListener
  • async function () {
    this.listener = await CodeScanner.addListener('CodeScannerCatchEvent', async (info) => {

When I try to add asynchronous processing(async/await etc), it doesn’t work.
If you have any suggestions for improvement, please let me know.