capacitor: * incorrectly extends interface 'Plugin'

Hi I got some errors about all plugins trying to extends interface Plugin. Maybe it’s due to me using TypeScript 3?

image

It concerns every plugins:

ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
72:18 Interface 'AppPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '{ (eventName: "appStateChange", listenerFunc: (state: AppState) => void): PluginListenerHandle; (eventName: "appUrlOpen", listenerFunc: (data: AppUrlOpen) => void): PluginListenerHandle; (eventName: "appRestoredResult", listenerFunc: (data: AppRestoredResult) => void): PluginListenerHandle; (eventName: "backButton",...' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"appStateChange"'.
    70 | }
    71 | export declare type ScreenReaderStateChangeCallback = (state: ScreenReaderEnabledResult) => void;
  > 72 | export interface AppPlugin extends Plugin {
       |                  ^
    73 |     /**
    74 |      * Force exit the app. This should only be used in conjunction with the `backButton` handler for Android to
    75 |      * exit the app when navigation is complete.
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
182:18 Interface 'BrowserPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '{ (eventName: "browserFinished", listenerFunc: (info: any) => void): PluginListenerHandle; (eventName: "browserPageLoaded", listenerFunc: (info: any) => void): PluginListenerHandle; }' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"browserFinished"'.
    180 |     }): void;
    181 | }
  > 182 | export interface BrowserPlugin extends Plugin {
        |                  ^
    183 |     /**
    184 |      * Open a page with the given URL
    185 |      */
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
787:18 Interface 'LocalNotificationsPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '{ (eventName: "localNotificationReceived", listenerFunc: (notification: LocalNotification) => void): PluginListenerHandle; (eventName: "localNotificationActionPerformed", listenerFunc: (notification: LocalNotificationActionPerformed) => void): PluginListenerHandle; }' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"localNotificationReceived"'.
    785 |     notificationRequest: any;
    786 | }
  > 787 | export interface LocalNotificationsPlugin extends Plugin {
        |                  ^
    788 |     schedule(options: {
    789 |         notifications: LocalNotification[];
    790 |     }): Promise<LocalNotificationScheduleResult>;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
864:18 Interface 'MotionPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '{ (eventName: "accel", listenerFunc: (event: MotionEventResult) => void): PluginListenerHandle; (eventName: "orientation", listenerFunc: (event: MotionOrientationEventResult) => void): PluginListenerHandle; }' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"accel"'.
    862 |     index: number;
    863 | }
  > 864 | export interface MotionPlugin extends Plugin {
        |                  ^
    865 |     /**
    866 |      * Listen for accelerometer data
    867 |      */
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
899:18 Interface 'NetworkPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: "networkStatusChange", listenerFunc: (status: NetworkStatus) => void) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"networkStatusChange"'.
    897 |     interval: number;
    898 | }
  > 899 | export interface NetworkPlugin extends Plugin {
        |                  ^
    900 |     /**
    901 |      * Query the current network status
    902 |      */
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/core-plugin-definitions.d.ts
1113:18 Interface 'PushNotificationsPlugin' incorrectly extends interface 'Plugin'.
  Types of property 'addListener' are incompatible.
    Type '{ (eventName: "registration", listenerFunc: (token: PushNotificationToken) => void): PluginListenerHandle; (eventName: "registrationError", listenerFunc: (error: any) => void): PluginListenerHandle; (eventName: "pushNotificationReceived", listenerFunc: (notification: PushNotification) => void): PluginListenerHandle;...' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'eventName' and 'eventName' are incompatible.
        Type 'string' is not assignable to type '"registration"'.
    1111 |     channels: PushNotificationChannel[];
    1112 | }
  > 1113 | export interface PushNotificationsPlugin extends Plugin {
         |                  ^
    1114 |     register(): Promise<void>;
    1115 |     getDeliveredNotifications(): Promise<PushNotificationDeliveredList>;
    1116 |     removeDeliveredNotifications(delivered: PushNotificationDeliveredList): Promise<void>;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/browser.d.ts
3:22 Class 'BrowserPluginWeb' incorrectly implements interface 'BrowserPlugin'.
  Types of property 'removeListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => void' is not assignable to type '(eventName: string, listenerFunc: Function) => void'.
      Types of parameters 'listenerFunc' and 'listenerFunc' are incompatible.
        Type 'Function' is not assignable to type 'ListenerCallback'.
          Type 'Function' provides no match for the signature '(err: any, ...args: any[]): void'.
    1 | import { WebPlugin } from './index';
    2 | import { BrowserPlugin, BrowserOpenOptions, BrowserPrefetchOptions } from '../core-plugin-definitions';
  > 3 | export declare class BrowserPluginWeb extends WebPlugin implements BrowserPlugin {
      |                      ^
    4 |     _lastWindow: Window;
    5 |     constructor();
    6 |     open(options: BrowserOpenOptions): Promise<void>;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/camera.d.ts
3:22 Class 'CameraPluginWeb' incorrectly implements interface 'CameraPlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
      Types of parameters 'listenerFunc' and 'listenerFunc' are incompatible.
        Type 'Function' is not assignable to type 'ListenerCallback'.
    1 | import { WebPlugin } from './index';
    2 | import { CameraPlugin, CameraPhoto, CameraOptions } from '../core-plugin-definitions';
  > 3 | export declare class CameraPluginWeb extends WebPlugin implements CameraPlugin {
      |                      ^
    4 |     constructor();
    5 |     getPhoto(options: CameraOptions): Promise<CameraPhoto>;
    6 |     private _getCameraPhoto(photo);
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/clipboard.d.ts
3:22 Class 'ClipboardPluginWeb' incorrectly implements interface 'ClipboardPlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { ClipboardPlugin, ClipboardWrite, ClipboardRead, ClipboardReadResult } from '../core-plugin-definitions';
  > 3 | export declare class ClipboardPluginWeb extends WebPlugin implements ClipboardPlugin {
      |                      ^
    4 |     constructor();
    5 |     write(options: ClipboardWrite): Promise<void>;
    6 |     read(_options: ClipboardRead): Promise<ClipboardReadResult>;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/device.d.ts
3:22 Class 'DevicePluginWeb' incorrectly implements interface 'DevicePlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { DeviceInfo, DevicePlugin } from '../core-plugin-definitions';
  > 3 | export declare class DevicePluginWeb extends WebPlugin implements DevicePlugin {
      |                      ^
    4 |     constructor();
    5 |     getInfo(): Promise<DeviceInfo>;
    6 |     parseUa(_ua: string): any;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/geolocation.d.ts
3:22 Class 'GeolocationPluginWeb' incorrectly implements interface 'GeolocationPlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { GeolocationPlugin, GeolocationOptions, GeolocationPosition, GeolocationWatchCallback } from '../core-plugin-definitions';
  > 3 | export declare class GeolocationPluginWeb extends WebPlugin implements GeolocationPlugin {
      |                      ^
    4 |     constructor();
    5 |     getCurrentPosition(options?: GeolocationOptions): Promise<GeolocationPosition>;
    6 |     watchPosition(options: GeolocationOptions, callback: GeolocationWatchCallback): string;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/modals.d.ts
3:22 Class 'ModalsPluginWeb' incorrectly implements interface 'ModalsPlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { ModalsPlugin, AlertOptions, PromptOptions, PromptResult, ConfirmOptions, ConfirmResult, ActionSheetOptions, ActionSheetResult } from '../core-plugin-definitions';
  > 3 | export declare class ModalsPluginWeb extends WebPlugin implements ModalsPlugin {
      |                      ^
    4 |     constructor();
    5 |     alert(options: AlertOptions): Promise<void>;
    6 |     prompt(options: PromptOptions): Promise<PromptResult>;
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/share.d.ts
3:22 Class 'SharePluginWeb' incorrectly implements interface 'SharePlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { SharePlugin, ShareOptions } from '../core-plugin-definitions';
  > 3 | export declare class SharePluginWeb extends WebPlugin implements SharePlugin {
      |                      ^
    4 |     constructor();
    5 |     share(options?: ShareOptions): Promise<void>;
    6 | }
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/storage.d.ts
3:22 Class 'StoragePluginWeb' incorrectly implements interface 'StoragePlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { StoragePlugin } from '../core-plugin-definitions';
  > 3 | export declare class StoragePluginWeb extends WebPlugin implements StoragePlugin {
      |                      ^
    4 |     KEY_PREFIX: string;
    5 |     constructor();
    6 |     get(options: {
ERROR in E:/meta-front/app/node_modules/@capacitor/core/dist/esm/web/toast.d.ts
3:22 Class 'ToastPluginWeb' incorrectly implements interface 'ToastPlugin'.
  Types of property 'addListener' are incompatible.
    Type '(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle' is not assignable to type '(eventName: string, listenerFunc: Function) => PluginListenerHandle'.
    1 | import { WebPlugin } from './index';
    2 | import { ToastPlugin, ToastShowOptions } from '../core-plugin-definitions';
  > 3 | export declare class ToastPluginWeb extends WebPlugin implements ToastPlugin {
      |                      ^
    4 |     constructor();
    5 |     show(options: ToastShowOptions): Promise<any>;
    6 | }

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Any idea in which release the fix will be? Thanks