question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

* incorrectly extends interface 'Plugin'

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
snekocommented, Sep 8, 2018

Any idea in which release the fix will be? Thanks

0reactions
ionitron-bot[bot]commented, Dec 18, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error 2430: Interface 'InAppBrowser' incorrectly extends ...
I still have the same problem with the 1.7.0 version of this plugin. node_modules\@types\cordova-plugin-inappbrowser\index.d.ts(27,11): error ...
Read more >
Typescript errors with KendoReact like error TS2430: Interface ...
ts:8:18 - error TS2430: Interface 'GridCellProps' incorrectly extends interface 'CellProps'. Types of property 'onChange' are incompatible. Type ...
Read more >
How to Easily Extend Interfaces in TypeScript - Webtips
interface Person { age: number } // ❌ This will cause the below error: // Interface 'Employee' incorrectly extends interface 'Person'.
Read more >
typescript interface extends error - Braindw
Error: Class 'Animal' incorrectly implements interface 'Shepherd'. ... Read More webpack common chunks plugin vs webpack dll pluginContinue, ...
Read more >
Handbook - Interfaces - TypeScript
How to write an interface with TypeScript. ... Class 'Clock' incorrectly implements interface 'ClockConstructor'. Type 'Clock' provides no match for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found