"addListener" in custom capacitor plugin

I am creating custom plugin with addListener in definitions.ts

addListener(eventName: 'serialportdata', listenerFunc: (data: any) => void): Promise<PluginListenerHandle> & PluginListenerHandlde;

But in web.ts, I have defined the following and return type error

async addListener(eventName:'serialportdata', listenerFunc:(data: any) => void) {
    listenerFunc({});
    return Promise.reject(`Method '${eventName}' not implemented.`) as any;
  }

Type 'Promise<any>' is not assignable to type 'Promise<PluginListenerHandle> & PluginListenerHandle'
Property 'addListener' is not assignable to the same property in base type 'WebPlugin'.
Property 'remove' is missing in type 'Promise<any>' but required in type 'PluginListenerHandle'

How should I solve it? I follow example online and they work, but mine did not.

You can just take out the import of Interface inside web.ts and you will get rid of this error. You don’t really need the interface in there.