Files
appium/packages/base-plugin/lib/plugin.js
Christopher Hiller 2289b45272 fix(types,base-plugin): fix static prop types for plugins
This change modifies the type of `BasePlugin.newMethodMap`, adds a
parameter to the `MethodMap` type, and updates the base plugin TS
config for better incremental builds.
2022-05-12 14:06:55 -07:00

36 lines
862 B
JavaScript

import {logger} from '@appium/support';
/**
* @implements {Plugin}
*/
class BasePlugin {
/**
* Subclasses should use type `import('@appium/types').MethodMap<SubclassName>`.
*
* This will verify that the commands in the `newMethodMap` property are
* valid. It is impossible to use a generic type param here; the type of this should really
* be something like `MethodMap<T extends BasePlugin>` but that isn't a thing TS does.
*
* @type {import('@appium/types').MethodMap<any>}
*/
static newMethodMap = {};
/** @type {Plugin['cliArgs']} */
cliArgs;
/**
* @param {string} pluginName
*/
constructor(pluginName) {
this.name = pluginName;
this.logger = logger.getLogger(`Plugin [${pluginName}]`);
}
}
export default BasePlugin;
export {BasePlugin};
/**
* @typedef {import('@appium/types').Plugin} Plugin
*/