diff --git a/src/core/loader/resource.ts b/src/core/loader/resource.ts index 6f61df3..47096d1 100644 --- a/src/core/loader/resource.ts +++ b/src/core/loader/resource.ts @@ -1,6 +1,6 @@ import axios, { AxiosResponse } from 'axios'; import { Disposable } from '../common/disposable'; -import { ensureArray } from '../../plugin/game/utils'; +import { ensureArray } from '../../plugin/utils'; import { has } from '../../plugin/utils'; import JSZip from 'jszip'; import { EmitableEvent, EventEmitter } from '../common/eventEmitter'; diff --git a/src/plugin/utils.ts b/src/plugin/utils.ts index 26de6b8..1efc3bf 100644 --- a/src/plugin/utils.ts +++ b/src/plugin/utils.ts @@ -253,3 +253,8 @@ export async function swapChapter(chapter: number, hard: number) { core.drawTip('读档成功'); }); } + +export function ensureArray(arr: T): T extends any[] ? T : T[] { + // @ts-ignore + return arr instanceof Array ? arr : [arr]; +}