Skip to content

Commit

Permalink
fix(lint): ts语法优化
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaojob committed Feb 6, 2024
1 parent 2c7da33 commit c16a7f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions typings/editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

// 生命周期事件类型
Expand Down

0 comments on commit c16a7f4

Please sign in to comment.