bug: extending PluginRegistry doesn't work like stated in the docs
See original GitHub issueDescription of the problem:
According to the “TypeScript Interface” section of https://capacitor.ionicframework.com/docs/plugins/, it should be possible to merge additional custom Plugins into the PluginRegistry
interface:
declare module '@capacitor/core' {
interface PluginRegistry {
Echo: EchoPlugin;
}
}
However this does not work, the type doesn’t get merged in:
Instead, the module has to be declared as @capacitor/core/dist/esm/core-plugin-definitions
:
declare module '@capacitor/core/dist/esm/core-plugin-definitions' {
interface PluginRegistry {
Echo: EchoPlugin;
}
}
TBH I don’t exactly understand why the first version doesn’t work, because dist/esm/index.d.ts
exports everything from ./core-plugin-definitions
🤷🏻♂️
Affected platform
- Android
- iOS
- electron
- web
OS of the development machine
- Windows
- macOS
- linux
Capacitor version: beta.25
node version: 10.x
npm version: 6.4
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:10 (7 by maintainers)
Top Results From Across the Web
The following method did not exist: 'org.springframework ...
Cause. When this error is displayed: The following method did not exist: 'org.springframework.plugin.core.PluginRegistry ...
Read more >Docker network driver plugins
Docker Engine network plugins enable Engine deployments to be extended to support a wide range of networking technologies, such as VXLAN, IPVLAN, MACVLAN...
Read more >San Diego Patch 2 - ServiceNow Docs
Actual behavior: The data pill is shown as 'undefined'. Flow Designer. PRB1566858. Email trigger flows do not run after upgrade to San Diego ......
Read more >Variant Effect Predictor Download and install - Ensembl
2 to run VEP, and installing cpanm to handle the installation of perl modules. These steps can be completed with the commands: perlbrew...
Read more >Supporting the new Android plugins APIs | Flutter
As of the 1.12 release, new plugin APIs are available for the Android platform. The old APIs based on PluginRegistry.Registrar won't be immediately ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this same issue. Here’s my Ionic Info.
For me it was the order of imports. I was importing Plugins before I was importing the custom plugin. Lost about half a day before I found this thread.
@simonhaenisch I find a method for instance import “capacitor-udp” import { Plugins } from “@capacitor/core”;
import the additional package before and you can find your plugin.