diff --git a/src/core/core.ts b/src/core/core.ts index 6a450efc..a1779420 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -5,8 +5,7 @@ import ServersPlugin from './ServersPlugin'; import { AsyncSeriesHook } from 'tapable'; class Editor extends EventEmitter { - canvas: fabric.Canvas; - // eslint-disable-next-line @typescript-eslint/no-explicit-any + canvas: fabric.Canvas | undefined; contextMenu: any; private pluginMap: { [propName: string]: IPluginTempl; @@ -104,7 +103,7 @@ class Editor extends EventEmitter { // 代理API事件 private _bindingApis(pluginRunTime: IPluginTempl) { const { apis = [] } = pluginRunTime.constructor; - apis.forEach((apiName) => { + apis.forEach((apiName: string) => { this[apiName] = function () { // eslint-disable-next-line prefer-rest-params return pluginRunTime[apiName].apply(pluginRunTime, [...arguments]); @@ -130,7 +129,7 @@ class Editor extends EventEmitter { } // 渲染右键菜单 - private _renderMenu(opt: fabric.IEvent, menu: IPluginMenu[]) { + private _renderMenu(opt: { e: MouseEvent }, menu: IPluginMenu[]) { if (menu.length !== 0) { this.contextMenu.hideAll(); this.contextMenu.setData(menu); diff --git a/typings/editor.d.ts b/typings/editor.d.ts index 8a1eba51..5076fbc4 100644 --- a/typings/editor.d.ts +++ b/typings/editor.d.ts @@ -3,12 +3,12 @@ * @Author: 秦少卫 * @Date: 2023-05-13 18:53:44 * @LastEditors: 秦少卫 - * @LastEditTime: 2024-02-06 17:54:39 + * @LastEditTime: 2024-02-06 18:03:50 * @Description: file content */ declare interface IPluginOption { - [propName: string]: unknown; + [propName: string]: unknown | undefined; } // 生命周期事件类型