diff --git a/.eslintrc.json b/.eslintrc.json index 5bc85a89..10a4f32d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -228,7 +228,10 @@ "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"], "@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as" }], "@typescript-eslint/consistent-type-exports": "error", - "@typescript-eslint/consistent-type-imports": ["error", { "prefer": "type-imports" }], + "@typescript-eslint/consistent-type-imports": ["error", { + "prefer": "type-imports", + "disallowTypeAnnotations": false + }], "@typescript-eslint/no-confusing-non-null-assertion": "error", "@typescript-eslint/no-confusing-void-expression": ["error", { "ignoreArrowShorthand": true }], "@typescript-eslint/no-duplicate-enum-values": "error", diff --git a/browser.config.ts b/browser.config.ts index 99e4c39f..ebaa5e4b 100644 --- a/browser.config.ts +++ b/browser.config.ts @@ -16,7 +16,6 @@ export default defineConfig({ '$modules': fileURLToPath(new URL('./modules', import.meta.url)), '$panel': fileURLToPath(new URL('./panel', import.meta.url)), '$renderer': fileURLToPath(new URL('./renderer', import.meta.url)), - '$types': fileURLToPath(new URL('./types', import.meta.url)), '$ui': fileURLToPath(new URL('./ui', import.meta.url)) } }, diff --git a/browser/components/PlunderReloadMessage.vue b/browser/components/PlunderReloadMessage.vue index 6816bea1..a8726944 100644 --- a/browser/components/PlunderReloadMessage.vue +++ b/browser/components/PlunderReloadMessage.vue @@ -33,7 +33,7 @@ const autoReloadMessage = computed(() => { - \ No newline at end of file diff --git a/browser/lib/plunder/attack.ts b/browser/lib/plunder/attack.ts index 480c1a7b..79349676 100644 --- a/browser/lib/plunder/attack.ts +++ b/browser/lib/plunder/attack.ts @@ -8,7 +8,6 @@ import { unitsRegex } from '$global/regex'; import { ipcSend, ipcInvoke } from '$renderer/ipc'; import { PlunderError } from '$browser/error'; import type { PlunderAttack } from '$global/objects/plunder'; -import type { PlaceUnitsAmount } from '$types/game'; export const eventTarget = new EventTarget(); diff --git a/browser/lib/plunder/data.ts b/browser/lib/plunder/data.ts index e95dfd70..46eda3a4 100644 --- a/browser/lib/plunder/data.ts +++ b/browser/lib/plunder/data.ts @@ -1,7 +1,7 @@ import { Deimos } from '$deimos/interface/ipc'; import { PlunderError } from '$browser/error'; -import { usePlunderStore, usePlunderConfigStore } from '$renderer/stores/plunder'; import { ipcInvoke } from '$renderer/ipc'; +import { usePlunderStore, usePlunderConfigStore } from '$renderer/stores/plunder'; export async function getPlunderInfo() { try { diff --git a/browser/lib/plunder/group.ts b/browser/lib/plunder/group.ts index 4f865043..d14a7bc0 100644 --- a/browser/lib/plunder/group.ts +++ b/browser/lib/plunder/group.ts @@ -1,12 +1,10 @@ -import { ref } from 'vue'; +import { ref, type Ref } from 'vue'; import { until, useStyleTag, useMutationObserver } from '@vueuse/core'; import { isInstanceOf, isInteger } from '$global/guards'; import { ipcInvoke, ipcSend } from '$renderer/ipc'; import { useFeaturesStore } from '$renderer/stores/features'; import { usePlunderConfigStore } from '$renderer/stores/plunder'; import { PlunderError } from '$browser/error'; -import type { Ref } from 'vue'; -import type { PlunderGroupType, PlunderGroupVillageType } from '$types/plunder'; class PlunderGroup implements PlunderGroupType { readonly id: number; diff --git a/browser/lib/plunder/next.ts b/browser/lib/plunder/next.ts index 029d23b2..ad9277a9 100644 --- a/browser/lib/plunder/next.ts +++ b/browser/lib/plunder/next.ts @@ -6,7 +6,6 @@ import { getPlunderTargets } from '$lib/plunder/targets'; import { PlunderError } from '$browser/error'; import { usePlunderConfigStore } from '$renderer/stores/plunder'; import { useCurrentVillageStore } from '$renderer/stores/village'; -import type { PlunderGroupType, PlunderGroupVillageType } from '$types/plunder'; import type { PlunderTargetInfo } from '$lib/plunder/targets'; export async function handleLackOfTargets(groupInfo: PlunderGroupType | null) { diff --git a/browser/lib/plunder/targets.ts b/browser/lib/plunder/targets.ts index 146dcb6a..cae31da1 100644 --- a/browser/lib/plunder/targets.ts +++ b/browser/lib/plunder/targets.ts @@ -7,8 +7,6 @@ import { PlunderError } from '$browser/error'; import { Kronos, resources as resourceList } from '$global/constants'; import { useCurrentVillageStore } from '$renderer/stores/village'; import { assertWallLevel } from '$global/guards'; -import type { Coords, WallLevel } from '$types/game'; -import type { PlunderTableButtons, PlunderTableResources } from '$types/plunder'; /** Informações sobre a aldeia-alvo. */ export class PlunderTargetInfo { diff --git a/browser/lib/plunder/templates.ts b/browser/lib/plunder/templates.ts index 27976f2b..e2121bb0 100644 --- a/browser/lib/plunder/templates.ts +++ b/browser/lib/plunder/templates.ts @@ -7,9 +7,7 @@ import { Kronos } from '$global/constants'; import { PlunderError } from '$browser/error'; import { ipcInvoke } from '$renderer/ipc'; import type { usePlunderConfigStore } from '$renderer/stores/plunder'; -import type { FarmUnits, FarmUnitsAmount, UserAlias } from '$types/game'; import type { PlunderTargetInfo } from '$browser/lib/plunder/targets'; -import type { CustomPlunderTemplateType } from '$types/plunder'; class TemplateUnits implements FarmUnitsAmount { spear = 0; diff --git a/browser/lib/plunder/units.ts b/browser/lib/plunder/units.ts index f7100603..757c684b 100644 --- a/browser/lib/plunder/units.ts +++ b/browser/lib/plunder/units.ts @@ -4,7 +4,6 @@ import { useUnitsStore } from '$renderer/stores/units'; import { assertUnit } from '$global/guards'; import { ipcInvoke } from '$renderer/ipc'; import { PlunderError } from '$browser/error'; -import type { AllUnits } from '$types/game'; /** Atualiza a quantidade de unidades disponíveis no assistente de saque. */ export async function queryAvailableUnits() { diff --git a/browser/lib/plunder/village.ts b/browser/lib/plunder/village.ts index 91bd500b..f17026e3 100644 --- a/browser/lib/plunder/village.ts +++ b/browser/lib/plunder/village.ts @@ -1,7 +1,6 @@ import { useCurrentVillageStore } from '$renderer/stores/village'; import { usePlunderStore } from '$renderer/stores/plunder'; import { ipcSend } from '$renderer/ipc'; -import type { PlunderPageListType, PlunderPageType } from '$types/plunder'; class PlunderPageList implements PlunderPageListType { readonly id: number; diff --git a/browser/lib/plunder/wall.ts b/browser/lib/plunder/wall.ts index a68869b0..2ae695f7 100644 --- a/browser/lib/plunder/wall.ts +++ b/browser/lib/plunder/wall.ts @@ -7,7 +7,6 @@ import { sendAttackFromPlace } from '$lib/plunder/attack'; import { PlunderError } from '$browser/error'; import { PlunderAttackWithLoot } from '$lib/plunder/resources'; import { queryAvailableUnits } from '$lib/plunder/units'; -import type { DemolitionTroops, StringWallLevel } from '$types/game'; import type { PlunderTargetInfo } from '$browser/lib/plunder/targets'; export async function destroyWall(info: PlunderTargetInfo): Promise { diff --git a/browser/stores/browser.ts b/browser/stores/browser.ts index 1827e7ac..6328fa19 100644 --- a/browser/stores/browser.ts +++ b/browser/stores/browser.ts @@ -1,6 +1,5 @@ -import { defineStore } from 'pinia'; import { ref } from 'vue'; -import type { PiniaBrowserStoreType } from '$types/stores'; +import { defineStore } from 'pinia'; export const useBrowserStore = defineStore('browser', () => { const isDeimosReady = ref(false); diff --git a/browser/views/PlunderView.vue b/browser/views/PlunderView.vue index 65b4010c..bd02dfb5 100644 --- a/browser/views/PlunderView.vue +++ b/browser/views/PlunderView.vue @@ -18,7 +18,6 @@ import { PlunderError } from '$browser/error'; import { ipcSend } from '$renderer/ipc'; import { Kronos } from '$global/constants'; import PlunderReload from '$browser/components/PlunderReload.vue'; -import type { PlunderGroupType } from '$types/plunder'; const ares = useAresStore(); const config = usePlunderConfigStore(); diff --git a/deimos/deimos.d.ts b/deimos/deimos.d.ts index 60866699..8a715076 100644 --- a/deimos/deimos.d.ts +++ b/deimos/deimos.d.ts @@ -1,11 +1,3 @@ -import type { ResourceAmount } from '$types/game'; -import type { - RawTribalWarsGameData, - RawPlunderInfo, - MarketDataTrader, - PremiumExchangeGraphResourceData -} from '$types/deimos'; - declare global { const Accountmanager: { readonly farm: RawPlunderInfo @@ -91,4 +83,6 @@ declare global { InfoMessage(message: string): void; SuccessMessage(message: string): void; }; -} \ No newline at end of file +} + +export {}; \ No newline at end of file diff --git a/deimos/interface/ipc.ts b/deimos/interface/ipc.ts index 9d15dfa1..55c951d1 100644 --- a/deimos/interface/ipc.ts +++ b/deimos/interface/ipc.ts @@ -4,7 +4,6 @@ import type { TribalWarsGameData } from '$deimos/models/data'; import type { PlunderInfo } from '$deimos/models/plunder'; import type { Units } from '$deimos/models/units'; import type { TribalWarsTiming } from '$deimos/models/timing'; -import type { UIMessageType } from '$types/deimos'; // Arquivos no diretório "interface" não podem importar de outras partes do Deimos. // Isso é para evitar que a importações dos protótipos feitas no index vazem para o resto do código. diff --git a/deimos/models/data.ts b/deimos/models/data.ts index 488effee..2ff01995 100644 --- a/deimos/models/data.ts +++ b/deimos/models/data.ts @@ -1,7 +1,5 @@ import { isString, isInteger } from '$global/guards'; import { isWorld } from '$global/guards'; -import type { RawTribalWarsGameData } from '$types/deimos'; -import type { TribalWarsGameDataType } from '$types/game'; /** `null` indica que o usuário se encontra numa página a partir da qual não é possível obter essas informações. */ export class TribalWarsGameData implements TribalWarsGameDataType { diff --git a/deimos/models/plunder.ts b/deimos/models/plunder.ts index ebd32071..8991403d 100644 --- a/deimos/models/plunder.ts +++ b/deimos/models/plunder.ts @@ -1,7 +1,5 @@ import { assertInteger, isInteger } from '$global/guards'; import { DeimosModelError } from '$deimos/interface/error'; -import type { RawPlunderInfo } from '$types/deimos'; -import type { PlunderInfoType } from '$types/plunder'; export class PlunderInfo implements PlunderInfoType { public readonly hideAttacked: boolean; diff --git a/deimos/models/timing.ts b/deimos/models/timing.ts index 9c152ab9..bcaf9c83 100644 --- a/deimos/models/timing.ts +++ b/deimos/models/timing.ts @@ -1,6 +1,4 @@ import { assertInteger } from '$global/guards'; -import type { TribalWarsTimingType } from '$types/game'; -import type { RawTiming } from '$types/deimos'; import { DeimosModelError } from '$deimos/interface/error'; export class TribalWarsTiming implements TribalWarsTimingType { diff --git a/deimos/models/units.ts b/deimos/models/units.ts index c7f27e27..798405be 100644 --- a/deimos/models/units.ts +++ b/deimos/models/units.ts @@ -1,5 +1,4 @@ import { assertString, isString } from '$global/guards'; -import type { UnitAmount, UnitsAmountAsStrings } from '$types/game'; interface MaybeNotArcherWorld extends Omit { archer?: string; diff --git a/deimos/tsconfig.json b/deimos/tsconfig.json index 97e29b57..c60c6bc7 100644 --- a/deimos/tsconfig.json +++ b/deimos/tsconfig.json @@ -3,7 +3,7 @@ "./**/*", "../global/**/*", "../renderer/**/*", - "../types/**/*" + "../typings/**/*" ], "compilerOptions": { @@ -17,8 +17,7 @@ "$modules/*": ["../modules/*"], "$panel/*": ["../panel/*"], "$phobos/*": ["../phobos/*"], - "$renderer/*": ["../renderer/*"], - "$types/*": ["../types/*"] + "$renderer/*": ["../renderer/*"] }, "alwaysStrict": true, diff --git a/electron/app/modules/standard.ts b/electron/app/modules/standard.ts index bb47a360..3798e093 100644 --- a/electron/app/modules/standard.ts +++ b/electron/app/modules/standard.ts @@ -1,10 +1,9 @@ -import { BrowserWindow, type BrowserWindowConstructorOptions } from 'electron'; +import { BrowserWindow } from 'electron'; import { isInstanceOf } from '$global/guards'; import { appIcon, moduleHtml } from '$electron/utils/files'; import { getMainWindow } from '$electron/utils/helpers'; import { ModuleCreationError } from '$electron/error'; import { setModuleDevMenu } from '$electron/menu/dev'; -import type { ModuleNames, ModuleRoutes, ModuleConstructorOptions } from '$types/modules'; const activeModules = new Map(); export const getActiveModule = (name: ModuleNames) => activeModules.get(name) ?? null; @@ -33,7 +32,7 @@ export function createModule( return; }; - const windowOptions: BrowserWindowConstructorOptions = { + const windowOptions: Electron.BrowserWindowConstructorOptions = { parent: mainWindow, width: 500, height: 600, diff --git a/electron/app/modules/website.ts b/electron/app/modules/website.ts index d8865c4b..0acb3230 100644 --- a/electron/app/modules/website.ts +++ b/electron/app/modules/website.ts @@ -5,7 +5,6 @@ import { getMainWindow } from '$electron/utils/helpers'; import { isAllowedOrigin } from '$global/guards'; import { ModuleCreationError } from '$electron/error'; import { setModuleDevMenu } from '$electron/menu/dev'; -import type { WebsiteModuleNames } from '$types/modules'; const activeWebsiteModules = new Map(); export const getActiveWebsiteModule = (name: WebsiteModuleNames) => activeWebsiteModules.get(name) ?? null; diff --git a/electron/app/phobos.ts b/electron/app/phobos.ts index dc1bdc38..5f196376 100644 --- a/electron/app/phobos.ts +++ b/electron/app/phobos.ts @@ -3,8 +3,6 @@ import { BrowserView } from 'electron'; import { assertString, assertInstanceOf, isInstanceOf } from '$global/guards'; import { getMainWindow } from '$electron/utils/helpers'; import { phobosJs } from '$electron/utils/files'; -import type { WebPreferences } from 'electron'; -import type { PhobosNames, PhobosOptions } from '$types/phobos'; const activePhobos = new Map(); @@ -39,7 +37,7 @@ export async function createPhobos(name: PhobosNames, url: URL, options?: Phobos }; }; - const webPreferences: WebPreferences = options?.webPreferences ?? {}; + const webPreferences: Electron.WebPreferences = options?.webPreferences ?? {}; webPreferences.preload = phobosJs; webPreferences.devTools = process.env.ARES_MODE === 'dev'; diff --git a/electron/child-process/error.ts b/electron/child-process/error.ts index 50216609..1869bcf9 100644 --- a/electron/child-process/error.ts +++ b/electron/child-process/error.ts @@ -3,7 +3,6 @@ import * as fs from 'node:fs/promises'; import { AresError } from '$global/error'; import { isString } from '$global/guards'; import { ErrorLogFile } from '$global/constants'; -import type { ElectronErrorLogType, OmitOptionalErrorLogProps } from '$types/error'; export class ChildProcessError extends AresError { constructor(message: string) { @@ -11,7 +10,7 @@ export class ChildProcessError extends AresError { this.name = 'ChildProcessError'; }; - public static override async catch(err: unknown) { + public static override async catch(err: unknown): Promise { if (!process.env.USER_DATA_PATH) return; if (err instanceof Error) { diff --git a/electron/child-process/world-data.ts b/electron/child-process/world-data.ts index d838a046..0f4faa44 100644 --- a/electron/child-process/world-data.ts +++ b/electron/child-process/world-data.ts @@ -6,8 +6,6 @@ import { Readable } from 'node:stream'; import { assertWorld } from '$global/guards'; import { getRegionFromWorld, getVillagesDataUrl } from '$global/helpers'; import { ChildProcessError } from '$electron/child-process/error'; -import type { World, GameRegion } from '$types/game'; -import type { WorldDataType, WorldVillagesType } from '$types/world'; const gunzip = promisify(zlib.gunzip); diff --git a/electron/database/config/config.ts b/electron/database/config/config.ts index 27febe0b..813265b9 100644 --- a/electron/database/config/config.ts +++ b/electron/database/config/config.ts @@ -1,7 +1,6 @@ import { sequelize } from '$electron/database'; import { DatabaseError } from '$electron/error'; import type { AppConfig as AppConfigTable } from '$database/config'; -import type { AppConfigName, AppConfigByName } from '$types/config'; import type { useAppGeneralConfigStore, useAppNotificationsStore } from '$electron/interface'; type OnlyConfig = Extract; diff --git a/electron/database/config/index.ts b/electron/database/config/index.ts index 0d8130e3..4bd5ce08 100644 --- a/electron/database/config/index.ts +++ b/electron/database/config/index.ts @@ -4,7 +4,6 @@ import { saveConfig, setConfig } from '$database/config/config'; import { savePanelBounds, setPanelBounds } from '$database/config/panel'; import { getLastRegionGameUrl, setGameRegion, saveGameRegion } from '$database/config/state'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { AppConfigName, AppConfigJSON } from '$types/config'; /** Diz respeito a configurações que abrangem toda a aplicação, independentemente do usuário. */ export class AppConfig extends Model, InferCreationAttributes> { diff --git a/electron/database/config/panel.ts b/electron/database/config/panel.ts index 621d8330..1aa2107e 100644 --- a/electron/database/config/panel.ts +++ b/electron/database/config/panel.ts @@ -1,7 +1,6 @@ import { sequelize } from '$electron/database'; import { DatabaseError } from '$electron/error'; import { getPanelWindow } from '$electron/utils/helpers'; -import type { Rectangle } from 'electron'; import type { AppConfig as AppConfigTable } from '$database/config'; export function setPanelBounds(AppConfig: typeof AppConfigTable) { @@ -10,7 +9,7 @@ export function setPanelBounds(AppConfig: typeof AppConfigTable) { const panelWindow = getPanelWindow(); const bounds = (await AppConfig.findByPk('panel_bounds'))?.toJSON(); if (!bounds?.json) return; - panelWindow.setBounds(bounds.json as Rectangle); + panelWindow.setBounds(bounds.json as Electron.Rectangle); } catch (err) { DatabaseError.catch(err); @@ -19,7 +18,7 @@ export function setPanelBounds(AppConfig: typeof AppConfigTable) { }; export function savePanelBounds(AppConfig: typeof AppConfigTable) { - return async function(rectangle: Rectangle) { + return async function(rectangle: Electron.Rectangle) { try { await sequelize.transaction(async (transaction) => { await AppConfig.upsert({ name: 'panel_bounds', json: rectangle }, { transaction }); diff --git a/electron/database/config/state.ts b/electron/database/config/state.ts index 669538c3..311e7445 100644 --- a/electron/database/config/state.ts +++ b/electron/database/config/state.ts @@ -5,8 +5,6 @@ import { getGameRegionUrl } from '$global/helpers'; import { isGameRegion } from '$global/guards'; import type { AppConfig as AppConfigTable } from '$database/config'; import type { useCacheStore } from '$electron/interface'; -import type { AppStateType } from '$types/config'; -import type { GameRegion } from '$types/game'; export function getLastRegionGameUrl(AppConfig: typeof AppConfigTable) { return async function() { diff --git a/electron/database/error.ts b/electron/database/error.ts index a57c18df..6d1fe7d6 100644 --- a/electron/database/error.ts +++ b/electron/database/error.ts @@ -1,8 +1,6 @@ import { DataTypes, Model } from 'sequelize'; import { sequelize } from '$electron/database'; import type { InferAttributes, InferCreationAttributes, CreationOptional } from 'sequelize'; -import type { ErrorLogType, ElectronErrorLogType } from '$types/error'; -import type { World } from '$types/game'; export class ErrorLog extends Model, InferCreationAttributes> implements ErrorLogType { declare readonly id: CreationOptional; diff --git a/electron/database/groups.ts b/electron/database/groups.ts index cc6a7715..0e3ade47 100644 --- a/electron/database/groups.ts +++ b/electron/database/groups.ts @@ -2,7 +2,6 @@ import { DataTypes, Model } from 'sequelize'; import { sequelize } from '$electron/database'; import { assertUserAlias } from '$global/guards'; import { DatabaseError } from '$electron/error'; -import type { UserAlias, VillageGroup, VillageGroupsType } from '$types/game'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; export class VillageGroups extends Model, InferCreationAttributes> implements VillageGroupsType { diff --git a/electron/database/plunder/config.ts b/electron/database/plunder/config.ts index 2b92e401..5e66a1aa 100644 --- a/electron/database/plunder/config.ts +++ b/electron/database/plunder/config.ts @@ -3,8 +3,6 @@ import { sequelize } from '$electron/database'; import { assertUserAlias, assertWallLevel } from '$global/guards'; import { DatabaseError } from '$electron/error'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { UserAlias, WallLevel } from '$types/game'; -import type { PlunderConfigType, BlindAttackPattern, UseCPattern } from '$types/plunder'; export class PlunderConfig extends Model, InferCreationAttributes> implements PlunderConfigType { declare readonly id: UserAlias; diff --git a/electron/database/plunder/demolition.ts b/electron/database/plunder/demolition.ts index 6468dde8..b6555866 100644 --- a/electron/database/plunder/demolition.ts +++ b/electron/database/plunder/demolition.ts @@ -4,8 +4,6 @@ import { assertUserAlias } from '$global/guards'; import { DatabaseError } from '$electron/error'; import { unitsToDestroyWall } from '$global/constants'; import type { InferAttributes, InferCreationAttributes, CreationOptional } from 'sequelize'; -import type { UnitsToDestroyWall, UserAlias } from '$types/game'; -import type { DemolitionTemplateType } from '$types/plunder'; export class DemolitionTemplate extends Model< InferAttributes, diff --git a/electron/database/plunder/history.ts b/electron/database/plunder/history.ts index c9f50f52..9f6ac971 100644 --- a/electron/database/plunder/history.ts +++ b/electron/database/plunder/history.ts @@ -3,8 +3,6 @@ import { sequelize } from '$electron/database'; import { assertUserAlias } from '$global/guards'; import { DatabaseError } from '$electron/error'; import type { CreationOptional, InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { UserAlias } from '$types/game'; -import type { PlunderHistoryType } from '$types/plunder'; import type { usePlunderHistoryStore } from '$electron/interface'; export class PlunderHistory extends Model, InferCreationAttributes> implements PlunderHistoryType { diff --git a/electron/database/plunder/template.ts b/electron/database/plunder/template.ts index 59b22e81..9cd1ad2e 100644 --- a/electron/database/plunder/template.ts +++ b/electron/database/plunder/template.ts @@ -4,8 +4,6 @@ import { sequelize } from '$electron/database'; import { assertUserAlias } from '$global/guards'; import { DatabaseError } from '$electron/error'; import type { InferAttributes, InferCreationAttributes, CreationOptional } from 'sequelize'; -import type { UserAlias } from '$types/game'; -import type { CustomPlunderTemplateType } from '$types/plunder'; export class CustomPlunderTemplate extends Model< InferAttributes, diff --git a/electron/database/world/config.ts b/electron/database/world/config.ts index df423621..f53d91c9 100644 --- a/electron/database/world/config.ts +++ b/electron/database/world/config.ts @@ -1,8 +1,6 @@ import { DataTypes, Model } from 'sequelize'; import { sequelize } from '$electron/database'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { WorldConfigType } from '$types/world'; -import type { World } from '$types/game'; export class WorldConfig extends Model, InferCreationAttributes> implements WorldConfigType { declare readonly id: World; diff --git a/electron/database/world/history.ts b/electron/database/world/history.ts index f2ae6cc0..de9c7aa7 100644 --- a/electron/database/world/history.ts +++ b/electron/database/world/history.ts @@ -3,8 +3,6 @@ import { sequelize } from '$electron/database'; import { DatabaseError } from '$electron/error'; import { assertWorld } from '$global/guards'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { World } from '$types/game'; -import type { WorldDataFetchHistoryType } from '$types/world'; export class WorldDataFetchHistory extends Model< InferAttributes, diff --git a/electron/database/world/units.ts b/electron/database/world/units.ts index 13b617d5..d2c832dc 100644 --- a/electron/database/world/units.ts +++ b/electron/database/world/units.ts @@ -1,8 +1,6 @@ import { DataTypes, Model } from 'sequelize'; import { sequelize } from '$electron/database'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { WorldUnitsType, UnitDetails } from '$types/world'; -import type { World } from '$types/game'; export class WorldUnits extends Model, InferCreationAttributes> implements WorldUnitsType { declare readonly id: World; diff --git a/electron/database/world/villages.ts b/electron/database/world/villages.ts index cf694204..e40f4c88 100644 --- a/electron/database/world/villages.ts +++ b/electron/database/world/villages.ts @@ -1,8 +1,6 @@ import { DataTypes, Model } from 'sequelize'; import { sequelize } from '$electron/database'; import type { InferAttributes, InferCreationAttributes } from 'sequelize'; -import type { World } from '$types/game'; -import type { WorldVillagesModel } from '$types/world'; const worldVillagesTableMap = new Map>(); diff --git a/electron/error.ts b/electron/error.ts index 601b0c76..7f63c55f 100644 --- a/electron/error.ts +++ b/electron/error.ts @@ -4,7 +4,6 @@ import { app } from 'electron'; import { AresError } from '$global/error'; import { isString } from '$global/guards'; import { ErrorLogFile } from '$global/constants'; -import type { ElectronErrorLogType, OmitOptionalErrorLogProps } from '$types/error'; export class MainProcessError extends AresError { constructor(message: string) { diff --git a/electron/events/config.ts b/electron/events/config.ts index 1138acfd..26520384 100644 --- a/electron/events/config.ts +++ b/electron/events/config.ts @@ -6,8 +6,6 @@ import { AppConfig, useAppGeneralConfigStore, useAppNotificationsStore } from '$ import { MainProcessEventError } from '$electron/error'; import { database } from '$electron/utils/files'; import { restartAres } from '$electron/utils/helpers'; -import type { ConfigModuleRoutes } from '$types/modules'; -import type { GeneralConfigType, NotificationsConfigType } from '$types/config'; export function setConfigEvents() { const appGeneralConfigStore = useAppGeneralConfigStore(); diff --git a/electron/events/deimos.ts b/electron/events/deimos.ts index 2a9a3943..7c3940c2 100644 --- a/electron/events/deimos.ts +++ b/electron/events/deimos.ts @@ -2,10 +2,6 @@ import { ipcMain } from 'electron'; import { readDeimosFile } from '$electron/app/deimos'; import { getPanelWindow } from '$electron/utils/helpers'; import { MainProcessEventError } from '$electron/error'; -import type { IpcMainEvent } from 'electron'; -import type { MechanusStore } from 'mechanus'; -import type { PlunderInfoType } from '$types/plunder'; -import type { UnitAmount, TribalWarsGameDataType, World } from '$types/game'; import { useAresStore, @@ -42,7 +38,9 @@ export function setDeimosEvents() { }); // Recebe os dados do jogo, salva-os localmente e então envia-os ao painel. - ipcMain.on('deimos:update-game-data', (_e: IpcMainEvent, gameData: TribalWarsGameDataType) => { + ipcMain.on('deimos:update-game-data', ( + _e: Electron.IpcMainEvent, gameData: TribalWarsGameDataType + ) => { try { for (const key of Object.keys(gameData) as T[]) { switch (key) { @@ -76,7 +74,7 @@ export function setDeimosEvents() { // Recebe as informações referentes ao assistente de saque, salva-as localmente e então envia-as ao painel. ipcMain.handle('deimos:update-plunder-info', ( - _e: IpcMainEvent, plunderInfo: PlunderInfoType + _e: Electron.IpcMainEvent, plunderInfo: PlunderInfoType ) => { try { for (const [key, value] of Object.entries(plunderInfo) as [T, typeof plunderStore[T]][]) { @@ -95,7 +93,7 @@ export function setDeimosEvents() { // Recebe as informações referentes às unidades da aldeia atual, salva-as localmente e então envia-as ao painel. ipcMain.handle('deimos:update-current-village-units', ( - _e: IpcMainEvent, units: UnitAmount + _e: Electron.IpcMainEvent, units: UnitAmount ) => { try { for (const [key, value] of Object.entries(units) as [T, typeof unitsStore[T]][]) { diff --git a/electron/events/dev.ts b/electron/events/dev.ts index 0e2467d1..193bf9d2 100644 --- a/electron/events/dev.ts +++ b/electron/events/dev.ts @@ -3,7 +3,6 @@ import { computed, storeToRefs } from 'mechanus'; import { getMainWindow, getPanelWindow } from '$electron/utils/helpers'; import { getMainViewWebContents } from '$electron/utils/view'; import { useBrowserViewStore } from '$electron/interface'; -import type { WebContents } from 'electron'; export function setDevEvents() { if (process.env.ARES_MODE !== 'dev') return; @@ -13,7 +12,7 @@ export function setDevEvents() { const { webContents: panelContents } = getPanelWindow(); const { currentWebContents: currentWebContentsMaybeNull } = storeToRefs(browserViewStore); - const contents = computed([currentWebContentsMaybeNull], () => { + const contents = computed([currentWebContentsMaybeNull], () => { return currentWebContentsMaybeNull.value ?? getMainViewWebContents(); }); diff --git a/electron/events/error.ts b/electron/events/error.ts index c77813f2..63bf4493 100644 --- a/electron/events/error.ts +++ b/electron/events/error.ts @@ -9,7 +9,6 @@ import { getActiveModule } from '$electron/app/modules'; import { ErrorLog, ElectronErrorLog, useAresStore } from '$electron/interface'; import { getMainWindow } from '$electron/utils/helpers'; import { ErrorLogFile } from '$global/constants'; -import type { AllErrorLogTypes, ErrorLogBase, ErrorLogType, OmitOptionalErrorLogProps } from '$types/error'; export function setErrorEvents() { const mainWindow = getMainWindow(); diff --git a/electron/events/index.ts b/electron/events/index.ts index 45b97e8f..1132a761 100644 --- a/electron/events/index.ts +++ b/electron/events/index.ts @@ -16,8 +16,6 @@ import { openAnyAllowedWebsite, openAresWebsite, openIssuesWebsite, openRepoWebs import { useCacheStore, useWorldConfigStore, worldUnitsMap } from '$electron/interface'; import { getPlayerNameFromAlias, extractWorldUnitsFromMap, getMainWindow } from '$electron/utils/helpers'; import { MainProcessEventError } from '$electron/error'; -import type { UserAlias } from '$types/game'; -import type { ElectronMessageBoxOptions } from '$types/electron'; export function setEvents() { const mainWindow = getMainWindow(); diff --git a/electron/events/modules/update.ts b/electron/events/modules/update.ts index 079cd7c5..14936d37 100644 --- a/electron/events/modules/update.ts +++ b/electron/events/modules/update.ts @@ -4,7 +4,6 @@ import semverValid from 'semver/functions/valid'; import { MainProcessEventError } from '$electron/error'; import { AppConfig } from '$electron/interface'; import { showAppUpdate } from '$electron/app/modules'; -import type { UpdateConfigType } from '$types/config'; export function setAppUpdateModuleEvents() { ipcMain.on('open-app-update-window', () => showAppUpdate()); diff --git a/electron/events/plunder/config.ts b/electron/events/plunder/config.ts index 47adbd48..2037a627 100644 --- a/electron/events/plunder/config.ts +++ b/electron/events/plunder/config.ts @@ -3,7 +3,6 @@ import { sequelize } from '$electron/database'; import { MainProcessEventError } from '$electron/error'; import { useCacheStore, usePlunderConfigStore, PlunderConfig } from '$electron/interface'; import { isUserAlias, assertUserAlias } from '$global/guards'; -import type { IpcMainEvent } from 'electron'; export function setPlunderConfigEvents() { const cacheStore = useCacheStore(); @@ -21,7 +20,7 @@ export function setPlunderConfigEvents() { // Recebe as configurações do Plunder do painel ou do módulo de configuração e as salva no banco de dados. ipcMain.on('plunder:update-config', async ( - e: IpcMainEvent, key: T, value: typeof plunderConfigStore[T] + e: Electron.IpcMainEvent, key: T, value: typeof plunderConfigStore[T] ) => { try { if (!(key in plunderConfigStore)) return; diff --git a/electron/events/plunder/demolition.ts b/electron/events/plunder/demolition.ts index e73c4421..ae6485d2 100644 --- a/electron/events/plunder/demolition.ts +++ b/electron/events/plunder/demolition.ts @@ -3,8 +3,6 @@ import { storeToRefs } from 'mechanus'; import { showDemolitionConfig } from '$electron/app/modules'; import { isUserAlias } from '$global/guards'; import { useCacheStore, usePlunderCacheStore, DemolitionTemplate } from '$electron/interface'; -import type { UserAlias } from '$types/game'; -import type { DemolitionTemplateType } from '$types/plunder'; export function setPlunderDemolitionEvents() { const cacheStore = useCacheStore(); diff --git a/electron/events/plunder/group.ts b/electron/events/plunder/group.ts index 6104d8f8..dadbe18e 100644 --- a/electron/events/plunder/group.ts +++ b/electron/events/plunder/group.ts @@ -5,7 +5,6 @@ import { MainProcessEventError } from '$electron/error'; import { GameSearchParams } from '$global/constants'; import { generateRandomDelay } from '$global/helpers'; import { usePlunderConfigStore, usePlunderCacheStore } from '$electron/interface'; -import type { PlunderGroupType, PlunderGroupVillageType } from '$types/plunder'; export function setPlunderGroupEvents() { const plunderCacheStore = usePlunderCacheStore(); diff --git a/electron/events/plunder/history.ts b/electron/events/plunder/history.ts index e5582df8..14019edd 100644 --- a/electron/events/plunder/history.ts +++ b/electron/events/plunder/history.ts @@ -6,7 +6,6 @@ import { getPanelWindow } from '$electron/utils/helpers'; import { showPlunderHistory, getActiveModuleWebContents } from '$electron/app/modules'; import { usePlunderHistoryStore, PlunderHistory, useCacheStore } from '$electron/interface'; import { PlunderHistoryVillage } from '$global/objects/plunder'; -import type { PlunderAttackLog, PlunderHistoryType } from '$types/plunder'; export function setPlunderHistoryEvents() { const panelWindow = getPanelWindow(); diff --git a/electron/events/plunder/index.ts b/electron/events/plunder/index.ts index 8a0e9ee4..195af340 100644 --- a/electron/events/plunder/index.ts +++ b/electron/events/plunder/index.ts @@ -10,8 +10,6 @@ import { setPlunderConfigEvents } from '$electron/events/plunder/config'; import { setPlunderHistoryEvents } from '$electron/events/plunder/history'; import { setPlunderDemolitionEvents } from '$electron/events/plunder/demolition'; import { setPlunderTemplatesEvents } from '$electron/events/plunder/templates'; -import type { UnitAmount, World } from '$types/game'; -import type { WorldUnitsType } from '$types/world'; export function setPlunderEvents() { const cacheStore = useCacheStore(); diff --git a/electron/events/plunder/page.ts b/electron/events/plunder/page.ts index 803b9c1a..1db040e5 100644 --- a/electron/events/plunder/page.ts +++ b/electron/events/plunder/page.ts @@ -4,7 +4,6 @@ import { MainProcessEventError } from '$electron/error'; import { usePlunderStore, usePlunderConfigStore, usePlunderCacheStore } from '$electron/interface'; import { GameSearchParams } from '$global/constants'; import { generateRandomDelay } from '$global/helpers'; -import type { PlunderPageListType } from '$types/plunder'; export function setPlunderPageEvents() { const plunderStore = usePlunderStore(); diff --git a/electron/events/plunder/templates.ts b/electron/events/plunder/templates.ts index 30039440..fd7e87d9 100644 --- a/electron/events/plunder/templates.ts +++ b/electron/events/plunder/templates.ts @@ -3,8 +3,6 @@ import { storeToRefs } from 'mechanus'; import { showCustomPlunderTemplate } from '$electron/app/modules'; import { isUserAlias } from '$global/guards'; import { useCacheStore, useBrowserViewStore, CustomPlunderTemplate } from '$electron/interface'; -import type { UserAlias } from '$types/game'; -import type { CustomPlunderTemplateType } from '$types/plunder'; export function setPlunderTemplatesEvents() { const cacheStore = useCacheStore(); diff --git a/electron/events/ui/download.ts b/electron/events/ui/download.ts index 63b6b1e1..4760dfa9 100644 --- a/electron/events/ui/download.ts +++ b/electron/events/ui/download.ts @@ -4,14 +4,12 @@ import { isString } from '$global/guards'; import { getMainWindow } from '$electron/utils/helpers'; import { getActiveModuleWebContents } from '$electron/app/modules'; import { DownloadError } from '$electron/error'; -import type { DownloadItem } from 'electron'; -import type { DownloadProgressType } from '$types/ares'; class DownloadProgress implements DownloadProgressType { readonly receivedBytes: number; readonly totalBytes: number; - constructor(item: DownloadItem) { + constructor(item: Electron.DownloadItem) { this.receivedBytes = item.getReceivedBytes(); this.totalBytes = item.getTotalBytes(); }; @@ -29,7 +27,7 @@ export function setMainWindowDownloadEvents() { }); }; -function handleUpdateDownload(item: DownloadItem) { +function handleUpdateDownload(item: Electron.DownloadItem) { const updateContents = getActiveModuleWebContents('app-update'); if (updateContents) { updateContents.send('will-download-update', new DownloadProgress(item)); diff --git a/electron/events/ui/menu.ts b/electron/events/ui/menu.ts index c6059ea5..ba3359e1 100644 --- a/electron/events/ui/menu.ts +++ b/electron/events/ui/menu.ts @@ -6,9 +6,6 @@ import { showErrorLog, openIssuesWebsite } from '$electron/app/modules'; import { AppConfig, useCacheStore } from '$electron/interface'; import { MainProcessError } from '$electron/error'; import { getGameRegionUrl } from '$global/helpers'; -import type { MenuItemConstructorOptions } from 'electron'; -import type { MechanusRef } from 'mechanus'; -import type { GameRegion } from '$types/game'; export function setMenuEvents() { const mainWindow = getMainWindow(); @@ -19,7 +16,7 @@ export function setMenuEvents() { AppConfig.setGameRegion(cacheStore).catch(MainProcessError.catch); ipcMain.on('open-region-select-menu', () => { - const template: MenuItemConstructorOptions[] = [ + const template: Electron.MenuItemConstructorOptions[] = [ { label: 'tribalwars.com.br', type: 'radio', click: () => void setGameRegion('br', region) } ]; @@ -39,7 +36,7 @@ export function setMenuEvents() { }); ipcMain.on('open-bug-report-menu', () => { - const template: MenuItemConstructorOptions[] = [ + const template: Electron.MenuItemConstructorOptions[] = [ { label: 'Registro de erros', click: () => showErrorLog() }, { label: 'Problemas conhecidos', click: () => openIssuesWebsite() } ]; @@ -49,7 +46,7 @@ export function setMenuEvents() { }); }; -function setCheckedGameRegion(template: MenuItemConstructorOptions[], region: GameRegion) { +function setCheckedGameRegion(template: Electron.MenuItemConstructorOptions[], region: GameRegion) { template.forEach((item) => { if (item.label?.endsWith(region) || (region === 'en' && item.label?.endsWith('net'))) { item.checked = true; diff --git a/electron/events/view.ts b/electron/events/view.ts index 4fcf27dd..f52470a2 100644 --- a/electron/events/view.ts +++ b/electron/events/view.ts @@ -5,8 +5,6 @@ import { useBrowserViewStore, useCacheStore } from '$electron/interface'; import { isAllowedOrigin } from '$global/guards'; import { getMainWindow } from '$electron/utils/helpers'; import { BrowserViewError } from '$electron/error'; -import type { WebContents, BrowserWindow } from 'electron'; -import type { MechanusRef } from 'mechanus'; import { insertViewCSS, @@ -101,8 +99,8 @@ export function setBrowserViewEvents() { * Esses eventos devem ser removidos quando a BrowserView for destruída. */ function setViewSharedEvents( - mainWindow: BrowserWindow = getMainWindow(), - mainViewWebContents: WebContents = getMainViewWebContents() + mainWindow: Electron.BrowserWindow = getMainWindow(), + mainViewWebContents: Electron.WebContents = getMainViewWebContents() ) { const browserViewStore = useBrowserViewStore(); const { allWebContents, registeredWebContents } = storeToRefs(browserViewStore); @@ -134,7 +132,7 @@ function setViewSharedEvents( * Se um novo evento for adicionado, é preciso adicionar a remoção dele na função `removePreviousViewEvents`. * @param view WebContents da BrowserView atual. */ -function setCurrentViewEvents(view: WebContents, mainWindow: BrowserWindow = getMainWindow()) { +function setCurrentViewEvents(view: Electron.WebContents, mainWindow: Electron.BrowserWindow = getMainWindow()) { view.on('did-start-loading', () => { mainWindow.webContents.send('current-view-did-start-loading'); }); @@ -168,7 +166,7 @@ function setCurrentViewEvents(view: WebContents, mainWindow: BrowserWindow = get * Esses eventos são definidos na função `setCurrentViewEvents`. * @param view WebContents da BrowserView atual. */ -function removePreviousViewEvents(view: WebContents) { +function removePreviousViewEvents(view: Electron.WebContents) { view.removeAllListeners('did-start-loading'); view.removeAllListeners('did-stop-loading'); view.removeAllListeners('did-navigate'); @@ -183,7 +181,7 @@ function removePreviousViewEvents(view: WebContents) { * @param rawUrl URL da nova BrowserView. * @returns BrowserView criada ou `null` se algo impedir a criação. */ -async function createBrowserView(rawUrl: string, mainWindow: BrowserWindow = getMainWindow()) { +async function createBrowserView(rawUrl: string, mainWindow: Electron.BrowserWindow = getMainWindow()) { try { mainWindow.webContents.send('browser-view-will-be-created'); const browserView = new BrowserView({ @@ -225,8 +223,8 @@ async function createBrowserView(rawUrl: string, mainWindow: BrowserWindow = get function destroyBrowserView( view: BrowserView, - mainWindow: BrowserWindow = getMainWindow(), - mainViewWebContents: WebContents = getMainViewWebContents() + mainWindow: Electron.BrowserWindow = getMainWindow(), + mainViewWebContents: Electron.WebContents = getMainViewWebContents() ) { try { const browserViewStore = useBrowserViewStore(); @@ -260,7 +258,7 @@ function destroyBrowserView( * @param view WebContents da BrowserView atual. * @param mainWindow Janela principal. */ -function updateCurrentViewBackForwardStatus(view: WebContents, mainWindow: BrowserWindow = getMainWindow()) { +function updateCurrentViewBackForwardStatus(view: Electron.WebContents, mainWindow: Electron.BrowserWindow = getMainWindow()) { const backForwardStatus = getBackForwardStatus(view); mainWindow.webContents.send('current-view-back-forward-status', backForwardStatus); }; @@ -271,14 +269,16 @@ function updateCurrentViewBackForwardStatus(view: WebContents, mainWindow: Brows * Uma nova BrowserView será criada se a URL for permitida. * @param contents WebContents da BrowserView. */ -function setWindowOpenHandler(contents: WebContents) { +function setWindowOpenHandler(contents: Electron.WebContents) { contents.setWindowOpenHandler(({ url }) => { queueMicrotask(() => createBrowserView(url)); return { action: 'deny' }; }); }; -function findBrowserViewByWebContentsId(webContentsId: number, mainWindow: BrowserWindow = getMainWindow()) { +function findBrowserViewByWebContentsId( + webContentsId: number, mainWindow: Electron.BrowserWindow = getMainWindow() +): Electron.BrowserView { const browserViews = mainWindow.getBrowserViews(); const browserView = browserViews.find((view) => view.webContents.id === webContentsId); if (browserView) return browserView; @@ -292,10 +292,10 @@ function findBrowserViewByWebContentsId(webContentsId: number, mainWindow: Brows * @param mainWindow Janela principal. */ function setViewAsTopBrowserView( - view: BrowserView, + view: Electron.BrowserView, currentAutoResize: MechanusRef<(() => void) | null>, - mainWindow: BrowserWindow = getMainWindow() -) { + mainWindow: Electron.BrowserWindow = getMainWindow() +): void { mainWindow.webContents.send('browser-view-will-be-set-as-top', view.webContents.id); mainWindow.setTopBrowserView(view); setBrowserViewBounds(view); @@ -310,10 +310,10 @@ function setViewAsTopBrowserView( * @param mainWindow Janela principal. */ function hideBrowserView( - view: BrowserView, + view: Electron.BrowserView, currentAutoResize: MechanusRef<(() => void) | null>, - mainWindow: BrowserWindow = getMainWindow() -) { + mainWindow: Electron.BrowserWindow = getMainWindow() +): void { mainWindow.webContents.send('browser-view-will-be-hidden', view.webContents.id); view.setBounds({ x: 0, y: 0, width: 0, height: 0 }); if (typeof currentAutoResize.value === 'function') { diff --git a/electron/events/world-data.ts b/electron/events/world-data.ts index 2a1438bd..fa5928e3 100644 --- a/electron/events/world-data.ts +++ b/electron/events/world-data.ts @@ -2,7 +2,6 @@ import { Op } from 'sequelize'; import { ipcMain } from 'electron'; import { getWorldVillagesTable, useCacheStore } from '$electron/interface'; import { isWorld } from '$global/guards'; -import type { World } from '$types/game'; export function setWorldDataEvents() { const cacheStore = useCacheStore(); diff --git a/electron/interface/alias.ts b/electron/interface/alias.ts index f700c788..d7414422 100644 --- a/electron/interface/alias.ts +++ b/electron/interface/alias.ts @@ -5,8 +5,6 @@ import { Kronos } from '$global/constants'; import { fetchVillageGroups, patchVillageGroups } from '$electron/utils/groups'; import { AliasInterfaceError } from '$electron/error'; import { sequelize } from '$electron/database'; -import type { UserAlias } from '$types/game'; -import type { PlunderConfigType, PlunderHistoryType, PlunderHistoryVillageType } from '$types/plunder'; import type { PlunderConfig as PlunderConfigTable, PlunderHistory as PlunderHistoryTable } from '$database/plunder'; import type { VillageGroups as VillageGroupsTable } from '$database/groups'; diff --git a/electron/interface/error.ts b/electron/interface/error.ts index bf89eada..1ef596cc 100644 --- a/electron/interface/error.ts +++ b/electron/interface/error.ts @@ -5,7 +5,6 @@ import { sequelize } from '$electron/database'; import { getActiveModule } from '$electron/app/modules'; import { getMainWindow } from '$electron/utils/helpers'; import { MainProcessError } from '$electron/error'; -import type { ElectronErrorLogType, OmitOptionalErrorLogProps } from '$types/error'; import type { useAppNotificationsStore } from '$electron/interface'; import type { ElectronErrorLog as ElectronErrorLogTable } from '$electron/interface'; diff --git a/electron/interface/world/config.ts b/electron/interface/world/config.ts index 06862647..4b52ddb7 100644 --- a/electron/interface/world/config.ts +++ b/electron/interface/world/config.ts @@ -3,9 +3,6 @@ import { WorldInterfaceError } from '$electron/error'; import { createPhobos, destroyPhobos } from '$electron/app/phobos'; import { getWorldConfigUrl } from '$global/helpers'; import { sequelize } from '$electron/database'; -import type { WorldConfigType } from '$types/world'; -import type { PhobosPortMessage } from '$types/phobos'; -import type { World } from '$types/game'; import type { WorldConfig as WorldConfigTable, useCacheStore as useCacheStoreType, diff --git a/electron/interface/world/data.ts b/electron/interface/world/data.ts index df27ae44..d163578f 100644 --- a/electron/interface/world/data.ts +++ b/electron/interface/world/data.ts @@ -3,8 +3,6 @@ import { sequelize } from '$electron/database'; import { Kronos } from '$global/constants'; import { childProcess } from '$electron/utils/files'; import { WorldInterfaceError } from '$electron/error'; -import type { World } from '$types/game'; -import type { WorldDataType } from '$types/world'; import type { WorldDataFetchHistory as WorldDataFetchHistoryTable, getWorldVillagesTable as getWorldVillagesTableType diff --git a/electron/interface/world/index.ts b/electron/interface/world/index.ts index 8d2eb13d..8b7d9d9b 100644 --- a/electron/interface/world/index.ts +++ b/electron/interface/world/index.ts @@ -3,7 +3,6 @@ import { WorldInterfaceError } from '$electron/error'; import { fetchWorldData } from '$interface/world/data'; import { patchWorldConfigStoreState } from '$interface/world/config'; import { patchWorldUnitsStoresState } from '$interface/world/units'; -import type { World } from '$types/game'; import type { defineWorldConfigStore, createWorldUnitStoresMap } from '$stores/world'; import type { defineCacheStore } from '$stores/cache'; diff --git a/electron/interface/world/units.ts b/electron/interface/world/units.ts index 61d5bcff..4434caf1 100644 --- a/electron/interface/world/units.ts +++ b/electron/interface/world/units.ts @@ -3,9 +3,6 @@ import { WorldInterfaceError } from '$electron/error'; import { createPhobos, destroyPhobos } from '$electron/app/phobos'; import { getWorldUnitInfoUrl } from '$global/helpers'; import { sequelize } from '$electron/database'; -import type { WorldUnitsType, UnitDetails } from '$types/world'; -import type { PhobosPortMessage } from '$types/phobos'; -import type { World } from '$types/game'; import type { WorldUnits as WorldUnitsTable } from '$electron/database/world'; import type { createWorldUnitStoresMap } from '$stores/world'; import type { defineCacheStore } from '$stores/cache'; diff --git a/electron/menu/dev.ts b/electron/menu/dev.ts index 24d9a254..80531bfa 100644 --- a/electron/menu/dev.ts +++ b/electron/menu/dev.ts @@ -3,18 +3,17 @@ import { computed, storeToRefs } from 'mechanus'; import { getMainWindow, getPanelWindow } from '$electron/utils/helpers'; import { getMainViewWebContents } from '$electron/utils/view'; import type { useBrowserViewStore } from '$electron/interface'; -import type { BrowserWindow, MenuItemConstructorOptions, WebContents } from 'electron'; -function getDevOptions(browserViewStore: ReturnType): MenuItemConstructorOptions[] { +function getDevOptions(browserViewStore: ReturnType): Electron.MenuItemConstructorOptions[] { const { webContents: mainContents } = getMainWindow(); const { webContents: panelContents } = getPanelWindow(); const { currentWebContents: currentWebContentsMaybeNull } = storeToRefs(browserViewStore); - const contents = computed([currentWebContentsMaybeNull], () => { + const contents = computed([currentWebContentsMaybeNull], () => { return currentWebContentsMaybeNull.value ?? getMainViewWebContents(); }); - const options: MenuItemConstructorOptions[] = [ + const options: Electron.MenuItemConstructorOptions[] = [ { label: 'Forçar atualização', accelerator: 'CmdOrCtrl+F5', click: () => contents.value.reloadIgnoringCache() }, { label: 'Conjurar magia', accelerator: 'F9', click: () => castDevMagic() }, { label: 'Inspecionar', accelerator: 'F10', click: () => contents.value.openDevTools({ mode: 'detach' }) }, @@ -30,7 +29,7 @@ function getDevOptions(browserViewStore: ReturnType) }; /** Adiciona o menu de desenvolvedor à janela. */ -export function setDevMenu(browserViewStore: ReturnType, ...args: BrowserWindow[]) { +export function setDevMenu(browserViewStore: ReturnType, ...args: Electron.BrowserWindow[]) { const options = getDevOptions(browserViewStore); for (const browserWindow of args) { if (process.env.ARES_MODE !== 'dev') { @@ -54,14 +53,14 @@ export function appendDevMenu(browserViewStore: ReturnType contents.reloadIgnoringCache() }, { label: 'Conjurar magia', accelerator: 'F9', click: () => castDevMagic() }, { label: 'Inspecionar', accelerator: 'CmdOrCtrl+F12', click: () => contents.openDevTools({ mode: 'detach' }) } diff --git a/electron/menu/menu.ts b/electron/menu/menu.ts index 7154d761..77a85958 100644 --- a/electron/menu/menu.ts +++ b/electron/menu/menu.ts @@ -4,7 +4,6 @@ import { showAppSettings } from '$electron/app/modules'; import { togglePanelWindow, getMainWindow, getPanelWindow } from '$electron/utils/helpers'; import { appendDevMenu } from '$electron/menu/dev'; import { getMainViewWebContents, contentsGoBack, contentsGoForward, contentsGoHome } from '$electron/utils/view'; -import type { MenuItemConstructorOptions, WebContents } from 'electron'; import type { useBrowserViewStore, useCacheStore } from '$electron/interface'; export function setAppMenu( @@ -15,11 +14,11 @@ export function setAppMenu( const panelWindow = getPanelWindow(); const { currentWebContents: currentWebContentsMaybeNull } = storeToRefs(browserViewStore); - const currentWebContents = computed([currentWebContentsMaybeNull], () => { + const currentWebContents = computed([currentWebContentsMaybeNull], () => { return currentWebContentsMaybeNull.value ?? getMainViewWebContents(); }); - const sharedOptions: MenuItemConstructorOptions[] = [ + const sharedOptions: Electron.MenuItemConstructorOptions[] = [ { label: 'Início', accelerator: 'CmdOrCtrl+Home', click: () => contentsGoHome(currentWebContents.value, cacheStore.region) }, { label: 'Atualizar', accelerator: 'F5', click: () => currentWebContents.value.reload() }, { label: 'Voltar', accelerator: 'CmdOrCtrl+Left', click: () => contentsGoBack(currentWebContents.value) }, diff --git a/electron/stores/ares.ts b/electron/stores/ares.ts index e5d27f1f..d5fecab1 100644 --- a/electron/stores/ares.ts +++ b/electron/stores/ares.ts @@ -1,6 +1,4 @@ -import { ref, type Mechanus } from 'mechanus'; -import type { World } from '$types/game'; -import type { MechanusAresStoreType } from '$types/stores'; +import { ref } from 'mechanus'; import { stringOrNullRef, diff --git a/electron/stores/cache.ts b/electron/stores/cache.ts index eaf1ed7b..1813e431 100644 --- a/electron/stores/cache.ts +++ b/electron/stores/cache.ts @@ -1,9 +1,7 @@ -import { computed, ref, type Mechanus } from 'mechanus'; +import { computed, ref } from 'mechanus'; import { isString } from '$global/guards'; import { generateUserAlias } from '$electron/utils/helpers'; import { gameRegionRef, worldRef, stringRef } from '$electron/utils/mechanus'; -import type { MechanusCacheStoreType } from '$types/stores'; -import type { GameRegion, UserAlias, World } from '$types/game'; export function defineCacheStore(mechanus: Mechanus) { const region = ref('br', gameRegionRef); diff --git a/electron/stores/config.ts b/electron/stores/config.ts index b8f2fd94..91035e01 100644 --- a/electron/stores/config.ts +++ b/electron/stores/config.ts @@ -1,7 +1,6 @@ import { app } from 'electron'; -import { ref, type Mechanus } from 'mechanus'; +import { ref } from 'mechanus'; import { booleanRef } from '$electron/utils/mechanus'; -import type { MechanusAppGeneralConfigStoreType, MechanusAppNotificationsConfigStoreType } from '$types/stores'; export function defineAppGeneralConfigStore(mechanus: Mechanus) { return mechanus.define('appGeneralConfig', { diff --git a/electron/stores/features.ts b/electron/stores/features.ts index 85e42524..1776d6e4 100644 --- a/electron/stores/features.ts +++ b/electron/stores/features.ts @@ -1,6 +1,5 @@ -import { ref, type Mechanus } from 'mechanus'; +import { ref } from 'mechanus'; import { booleanOrNullRef } from '$electron/utils/mechanus'; -import type { MechanusFeaturesStoreType } from '$types/stores'; export function defineFeaturesStore(mechanus: Mechanus) { return mechanus.define('features', { diff --git a/electron/stores/groups.ts b/electron/stores/groups.ts index 7086ce74..ffa958d1 100644 --- a/electron/stores/groups.ts +++ b/electron/stores/groups.ts @@ -1,7 +1,5 @@ -import { ref, type Mechanus } from 'mechanus'; +import { ref } from 'mechanus'; import { integerOrNullRef } from '$electron/utils/mechanus'; -import type { MechanusGroupsStoreType } from '$types/stores'; -import type { VillageGroup } from '$types/game'; export function defineGroupsStore(mechanus: Mechanus) { return mechanus.define('groups', { diff --git a/electron/stores/player.ts b/electron/stores/player.ts index d0745a62..042e1847 100644 --- a/electron/stores/player.ts +++ b/electron/stores/player.ts @@ -1,6 +1,5 @@ -import { ref, type Mechanus } from 'mechanus'; +import { ref } from 'mechanus'; import { integerOrNullRef, stringOrNullRef } from '$electron/utils/mechanus'; -import type { MechanusPlayerStoreType } from '$types/stores'; export function definePlayerStore(mechanus: Mechanus) { return mechanus.define('player', { diff --git a/electron/stores/plunder/config.ts b/electron/stores/plunder/config.ts index 780cc26d..dd208ecf 100644 --- a/electron/stores/plunder/config.ts +++ b/electron/stores/plunder/config.ts @@ -1,8 +1,6 @@ import { ref } from 'mechanus'; import { Kronos } from '$global/constants'; import { isInteger, isFiniteNumber } from '$global/guards'; -import type { WallLevel } from '$types/game'; -import type { Mechanus, MechanusRefOptions } from 'mechanus'; import { booleanRef, @@ -13,9 +11,6 @@ import { positiveIntegerOrNullRef } from '$electron/utils/mechanus'; -import type { BlindAttackPattern, UseCPattern } from '$types/plunder'; -import type { MechanusPlunderConfigStoreType } from '$types/stores'; - // Patterns. const blindAttackPatterns: BlindAttackPattern[] = ['smaller', 'bigger']; const useCPatterns: UseCPattern[] = ['excess', 'normal', 'only']; diff --git a/electron/stores/plunder/history.ts b/electron/stores/plunder/history.ts index 422a5f4e..87d95585 100644 --- a/electron/stores/plunder/history.ts +++ b/electron/stores/plunder/history.ts @@ -1,9 +1,6 @@ import { ref } from 'mechanus'; import { positiveIntegerRef } from '$electron/utils/mechanus'; import { PlunderHistoryVillage } from '$global/objects/plunder'; -import type { Mechanus } from 'mechanus'; -import type { MechanusPlunderHistoryStoreType } from '$types/stores'; -import type { PlunderHistoryType, PlunderHistoryVillageType } from '$types/plunder'; const villages = new Proxy({} as PlunderHistoryType['villages'], { get(target, villageId): PlunderHistoryVillageType[] { diff --git a/electron/stores/plunder/index.ts b/electron/stores/plunder/index.ts index 42868ece..b6e7c343 100644 --- a/electron/stores/plunder/index.ts +++ b/electron/stores/plunder/index.ts @@ -1,8 +1,5 @@ import { ref } from 'mechanus'; import { integerRef, booleanRef, integerOrNullRef } from '$electron/utils/mechanus'; -import type { Mechanus } from 'mechanus'; -import type { PlunderPageListType, DemolitionTemplateType, PlunderGroupType } from '$types/plunder'; -import type { MechanusPlunderStoreType, MechanusPlunderCacheStoreType } from '$types/stores'; export * from '$stores/plunder/config'; export * from '$stores/plunder/history'; diff --git a/electron/stores/units.ts b/electron/stores/units.ts index 66c38903..45cce7e1 100644 --- a/electron/stores/units.ts +++ b/electron/stores/units.ts @@ -1,6 +1,5 @@ -import { ref, type Mechanus } from 'mechanus'; +import { ref } from 'mechanus'; import { integerRef } from '$electron/utils/mechanus'; -import type { MechanusUnitsStoreType } from '$types/stores'; export function defineUnitsStore(mechanus: Mechanus) { return mechanus.define('units', { diff --git a/electron/stores/view.ts b/electron/stores/view.ts index 15f7cdf4..5f8ee47d 100644 --- a/electron/stores/view.ts +++ b/electron/stores/view.ts @@ -1,12 +1,10 @@ -import { ref, type Mechanus } from 'mechanus'; -import type { WebContents } from 'electron'; -import type { MechanusBrowserViewStoreType } from '$types/stores'; +import { ref } from 'mechanus'; export function defineBrowserViewStore(mechanus: Mechanus) { return mechanus.define('browser-view', { - allWebContents: ref>(new Set()), - registeredWebContents: ref>(new WeakSet()), - currentWebContents: ref(null), + allWebContents: ref>(new Set()), + registeredWebContents: ref>(new WeakSet()), + currentWebContents: ref(null), currentAutoResize: ref<(() => void) | null>(null) } satisfies MechanusBrowserViewStoreType); }; \ No newline at end of file diff --git a/electron/stores/village.ts b/electron/stores/village.ts index 19697061..0b8dc733 100644 --- a/electron/stores/village.ts +++ b/electron/stores/village.ts @@ -1,7 +1,5 @@ import { computed, ref } from 'mechanus'; import { integerOrNullRef, stringOrNullRef } from '$electron/utils/mechanus'; -import type { Mechanus, MechanusComputedRef } from 'mechanus'; -import type { MechanusCurrentVillageStoreType } from '$types/stores'; export function defineCurrentVillageStore(mechanus: Mechanus) { const x = ref(null, integerOrNullRef); diff --git a/electron/stores/world.ts b/electron/stores/world.ts index 8a6f8076..0487d4c0 100644 --- a/electron/stores/world.ts +++ b/electron/stores/world.ts @@ -1,10 +1,6 @@ import { ref } from 'mechanus'; import { finiteNumberRef, integerRef, booleanRef } from '$electron/utils/mechanus'; import { allUnits } from '$global/constants'; -import type { AllUnits } from '$types/game'; -import type { UnitDetails } from '$types/world'; -import type { Mechanus, MechanusStore } from 'mechanus'; -import type { MechanusWorldConfigStoreType, MechanusWorldUnitStoreType, WorldUnitStoresMap } from '$types/stores'; export function defineWorldConfigStore(mechanus: Mechanus) { return mechanus.define('worldConfig', { diff --git a/electron/tsconfig.json b/electron/tsconfig.json index 77e56cd8..25eda76b 100644 --- a/electron/tsconfig.json +++ b/electron/tsconfig.json @@ -1,7 +1,7 @@ { "include": [ "./**/*", - "../types/**/*" + "../typings/**/*" ], "compilerOptions": { @@ -13,8 +13,7 @@ "$global/*": ["../global/*"], "$interface/*": ["./interface/*"], "$renderer/*": ["../renderer/*"], - "$stores/*": ["./stores/*"], - "$types/*": ["../types/*"] + "$stores/*": ["./stores/*"] }, "alwaysStrict": true, diff --git a/electron/utils/groups.ts b/electron/utils/groups.ts index 578abe2e..3d2d488b 100644 --- a/electron/utils/groups.ts +++ b/electron/utils/groups.ts @@ -4,12 +4,9 @@ import { assertInstanceOf } from '$global/guards'; import { createPhobos, destroyPhobos } from '$electron/app/phobos'; import { getMainViewWebContents } from '$electron/utils/view'; import { getPanelWindow } from '$electron/utils/helpers'; -import type { MechanusRef } from 'mechanus'; -import type { VillageGroup } from '$types/game'; -import type { PhobosPortMessage } from '$types/phobos'; -export function fetchVillageGroups() { - return new Promise>(async (resolve, reject) => { +export function fetchVillageGroups(): Promise> { + return new Promise(async (resolve, reject) => { // Cria o Phobos na tela de grupos manuais. // Lá é possível obter tanto os grupos manuais quanto os dinâmicos. const mainViewWebContents = getMainViewWebContents(); @@ -37,7 +34,7 @@ export function fetchVillageGroups() { }); }; -export function patchVillageGroups(groups: Set, all: MechanusRef>) { +export function patchVillageGroups(groups: Set, all: MechanusRef>): void { all.value.clear(); groups.forEach((group) => { all.value.add(group); diff --git a/electron/utils/helpers.ts b/electron/utils/helpers.ts index e08c4f83..64cbf6f4 100644 --- a/electron/utils/helpers.ts +++ b/electron/utils/helpers.ts @@ -2,8 +2,6 @@ import { app, BrowserWindow } from 'electron'; import { assertInstanceOf } from '$global/guards'; import { assertWorld } from '$global/guards'; import { MainProcessError } from '$electron/error'; -import type { UserAlias, World } from '$types/game'; -import type { WorldUnitsType } from '$types/world'; import type { createWorldUnitStoresMap } from '$stores/world'; export function restartAres() { @@ -11,14 +9,14 @@ export function restartAres() { app.quit(); }; -export const getMainWindow = () => { +export function getMainWindow(): BrowserWindow { const id = Number.parseIntStrict(process.env.MAIN_WINDOW_ID ?? ''); const mainWindow = BrowserWindow.fromId(id); assertInstanceOf(mainWindow, BrowserWindow, 'Could not get main window.'); return mainWindow; }; -export const getPanelWindow = () => { +export function getPanelWindow(): BrowserWindow { const id = Number.parseIntStrict(process.env.PANEL_WINDOW_ID ?? ''); const panelWindow = BrowserWindow.fromId(id); assertInstanceOf(panelWindow, BrowserWindow, 'Could not get panel window.'); @@ -26,7 +24,7 @@ export const getPanelWindow = () => { }; /** Exibe ou oculta a janela do painel. */ -export function togglePanelWindow() { +export function togglePanelWindow(): void { const mainWindow = getMainWindow(); const panelWindow = getPanelWindow(); @@ -49,7 +47,7 @@ export function togglePanelWindow() { * @param window Janela a ser maximizada ou restaurada. * @returns Booleano indicando se a janela está maximizada. */ -export function maximizeOrRestoreWindow(window: BrowserWindow) { +export function maximizeOrRestoreWindow(window: BrowserWindow): boolean { if (window.isMaximized()) { window.restore(); } else { diff --git a/electron/utils/mechanus.ts b/electron/utils/mechanus.ts index 97f796dc..7cbd37e9 100644 --- a/electron/utils/mechanus.ts +++ b/electron/utils/mechanus.ts @@ -1,7 +1,5 @@ -import { isFiniteNumber, isInteger, isString, isGameRegion, isWorld, isWallLevel } from '$global/guards'; import { MechanusStoreError } from '$electron/error'; -import type { MechanusRefOptions } from 'mechanus'; -import type { GameRegion, World, WallLevel } from '$types/game'; +import { isFiniteNumber, isInteger, isString, isGameRegion, isWorld, isWallLevel } from '$global/guards'; export const arrayIncludesRef = (array: T[]): MechanusRefOptions => ({ validator: (value: unknown): value is T => array.includes(value as T), diff --git a/electron/utils/view.ts b/electron/utils/view.ts index 22d68318..c0a2321b 100644 --- a/electron/utils/view.ts +++ b/electron/utils/view.ts @@ -1,21 +1,20 @@ -import { readFile } from 'node:fs/promises'; +import * as fs from 'node:fs/promises'; import { webContents } from 'electron'; import { browserCss } from '$electron/utils/files'; import { getMainWindow } from '$electron/utils/helpers'; import { Dimensions, GameUrl } from '$global/constants'; import { BrowserViewError } from '$electron/error'; -import type { WebContents, BrowserView, BrowserWindow, IpcMainEvent } from 'electron'; -import type { BackForwardStatus } from '$types/view'; -import type { GameRegion } from '$types/game'; -export const getMainViewWebContents = () => { +export function getMainViewWebContents(): Electron.WebContents { const id = Number.parseIntStrict(process.env.MAIN_VIEW_WEB_CONTENTS_ID ?? ''); const mainViewWebContents = webContents.fromId(id); if (!mainViewWebContents) throw new BrowserViewError('Could not get main view web contents.'); return mainViewWebContents; }; -export function setBrowserViewBounds(view: BrowserView, mainWindow: BrowserWindow = getMainWindow()) { +export function setBrowserViewBounds( + view: Electron.BrowserView, mainWindow: Electron.BrowserWindow = getMainWindow() +): void { const { width, height } = mainWindow.getContentBounds(); view.setBounds({ x: 0, y: Dimensions.TopContainerHeight, width, height: height - Dimensions.TopContainerHeight }); }; @@ -25,9 +24,11 @@ export function setBrowserViewBounds(view: BrowserView, mainWindow: BrowserWindo * @param view BrowserView a ser redimensionado. * @returns Função para remover o evento de redimensionamento. */ -export function setBrowserViewAutoResize(view: BrowserView, mainWindow: BrowserWindow = getMainWindow()): () => void { - let timeout: ReturnType | null = null; - function resize(e: IpcMainEvent) { +export function setBrowserViewAutoResize( + view: Electron.BrowserView, mainWindow: Electron.BrowserWindow = getMainWindow() +): () => void { + let timeout: NodeJS.Immediate | null = null; + function resize(e: Electron.IpcMainEvent) { e.preventDefault(); timeout = setImmediate(() => { if (timeout) clearImmediate(timeout); @@ -44,22 +45,22 @@ export function setBrowserViewAutoResize(view: BrowserView, mainWindow: BrowserW * Retorna um objeto com informações sobre a capacidade de navegação do WebContents. * @param contents WebContents da janela ou do BrowserView. */ -export function getBackForwardStatus(contents: WebContents): BackForwardStatus { +export function getBackForwardStatus(contents: Electron.WebContents): BackForwardStatus { return { canGoBack: contents.canGoBack(), canGoForward: contents.canGoForward() }; }; -export function contentsGoBack(contents: WebContents) { +export function contentsGoBack(contents: Electron.WebContents): void { if (contents.canGoBack()) contents.goBack(); }; -export function contentsGoForward(contents: WebContents) { +export function contentsGoForward(contents: Electron.WebContents): void { if (contents.canGoForward()) contents.goForward(); }; -export function contentsGoHome(contents: WebContents, region: GameRegion) { +export function contentsGoHome(contents: Electron.WebContents, region: GameRegion): void { let homeUrl: GameUrl; switch (region) { case 'br': @@ -92,10 +93,10 @@ export function contentsGoHome(contents: WebContents, region: GameRegion) { * @param contents WebContents da BrowserView. * @param css CSS a ser inserido. Se omitido, será usado o CSS padrão do browser. */ -export async function insertViewCSS(contents?: WebContents, css?: string) { +export async function insertViewCSS(contents?: Electron.WebContents, css?: string): Promise { try { contents ??= getMainViewWebContents(); - css ??= await readFile(browserCss, { encoding: 'utf8' }); + css ??= await fs.readFile(browserCss, { encoding: 'utf8' }); await contents.insertCSS(css); } catch (err) { BrowserViewError.catch(err); diff --git a/global/error.ts b/global/error.ts index 187a6efc..b6af62cb 100644 --- a/global/error.ts +++ b/global/error.ts @@ -1,5 +1,3 @@ -import type { AllErrorLogTypes } from '$types/error'; - export class AresError extends Error { declare public static catch: (err: unknown) => Promise; diff --git a/global/guards/ares.ts b/global/guards/ares.ts index e7908cad..51c460f6 100644 --- a/global/guards/ares.ts +++ b/global/guards/ares.ts @@ -1,7 +1,6 @@ import { isString } from '$global/guards/base'; import { aliasRegex, allowedOriginRegexList } from '$global/regex'; import type { AresError } from '$global/error'; -import type { UserAlias } from '$types/game'; export const isUserAlias = (alias: unknown): alias is UserAlias => (isString(alias) && aliasRegex.test(alias)); export function assertUserAlias(alias: unknown, SomeError: T, message?: string): asserts alias is UserAlias { diff --git a/global/guards/game.ts b/global/guards/game.ts index 87a400e5..88193d72 100644 --- a/global/guards/game.ts +++ b/global/guards/game.ts @@ -2,7 +2,6 @@ import { isFiniteNumber, isInteger, isString } from '$global/guards/base'; import { farmUnits, allUnits } from '$global/constants'; import { regionRegex, worldRegex } from '$global/regex'; import type { AresError } from '$global/error'; -import type { FarmUnits, GameRegion, World, WallLevel, AllUnits } from '$types/game'; /** Verifica se o valor passado é um nome válido de unidade. */ export const isUnit = (unit: unknown): unit is AllUnits => allUnits.includes(unit as AllUnits); diff --git a/global/helpers.ts b/global/helpers.ts index 10104054..e0ba196b 100644 --- a/global/helpers.ts +++ b/global/helpers.ts @@ -1,6 +1,5 @@ import { isInteger, assertGameRegion } from '$global/guards'; import { GameUrl, GameEndpoints } from '$global/constants'; -import type { GameRegion, UserAlias, World } from '$types/game'; import type { AresError } from '$global/error'; /** diff --git a/global/objects/plunder.ts b/global/objects/plunder.ts index 2092c88d..23e6162a 100644 --- a/global/objects/plunder.ts +++ b/global/objects/plunder.ts @@ -1,5 +1,3 @@ -import type { PlunderAttackLog, PlunderHistoryVillageType } from '$types/plunder'; - export abstract class PlunderAttack implements PlunderAttackLog { // Já incluso o ataque enviado. readonly attackAmount: number = 1; diff --git a/modules.config.ts b/modules.config.ts index 5b165969..8ada132d 100644 --- a/modules.config.ts +++ b/modules.config.ts @@ -15,7 +15,6 @@ export default defineConfig({ '$modules': fileURLToPath(new URL('./modules', import.meta.url)), '$panel': fileURLToPath(new URL('./panel', import.meta.url)), '$renderer': fileURLToPath(new URL('./renderer', import.meta.url)), - '$types': fileURLToPath(new URL('./types', import.meta.url)), '$ui': fileURLToPath(new URL('./ui', import.meta.url)) } }, diff --git a/modules/components/ConfigGeneral.vue b/modules/components/ConfigGeneral.vue index 7d27fcc9..4cbf50e0 100644 --- a/modules/components/ConfigGeneral.vue +++ b/modules/components/ConfigGeneral.vue @@ -27,7 +27,7 @@ watch(config, () => ipcSend('update-app-general-config', toRaw(config))); - \ No newline at end of file + \ No newline at end of file diff --git a/ui/components/TheUpdateNotification.vue b/ui/components/TheUpdateNotification.vue index 5939c81a..990c2cbe 100644 --- a/ui/components/TheUpdateNotification.vue +++ b/ui/components/TheUpdateNotification.vue @@ -5,7 +5,6 @@ import { useFetch } from '@vueuse/core'; import { NTag } from 'naive-ui'; import { ipcInvoke, ipcSend } from '$renderer/ipc'; import { AresAPI } from '$global/constants'; -import type { LatestVersion } from '$types/ares'; const appVersion = await ipcInvoke('app-version'); const { data } = useFetch(AresAPI.Latest).json(); diff --git a/ui/components/WindowMenu.vue b/ui/components/WindowMenu.vue index 5dd86fb1..8b2fd94e 100644 --- a/ui/components/WindowMenu.vue +++ b/ui/components/WindowMenu.vue @@ -9,7 +9,6 @@ import { ipcSend, ipcInvoke } from '$renderer/ipc'; import { WebsiteUrl } from '$global/constants'; import TheResponseTime from '$ui/components/TheResponseTime.vue'; import TheUpdateNotification from '$ui/components/TheUpdateNotification.vue'; -import type { BackForwardStatus } from '$types/view'; import { ArrowBackSharp, diff --git a/ui/components/WindowTabs.vue b/ui/components/WindowTabs.vue index 923fafe5..e3dfac2c 100644 --- a/ui/components/WindowTabs.vue +++ b/ui/components/WindowTabs.vue @@ -7,15 +7,14 @@ import { assertInteger } from '$global/guards'; import { ipcInvoke, ipcSend } from '$renderer/ipc'; import WindowTabsButtons from '$ui/components/WindowTabsButtons.vue'; import LightIcon from '$icons/units/LightIcon.vue'; -import type { WebContents } from 'electron'; const tabsContainer = ref(null); const { width } = useElementSize(tabsContainer); const tabsWidth = computed(() => `${width.value - 150}px`); -const allTabs = reactive>(new Map()); +const allTabs = reactive>(new Map()); const mainViewWebContentsId = await ipcInvoke('main-view-web-contents-id'); -const activeView = ref(mainViewWebContentsId); +const activeView = ref(mainViewWebContentsId); watch(activeView, (webContentsId) => ipcSend('update-current-view', webContentsId)); useIpcRendererOn('focus-main-view', () => (activeView.value = mainViewWebContentsId)); @@ -38,7 +37,7 @@ useIpcRendererOn('browser-view-title-updated', (_e, webContentsId: number, viewT allTabs.set(webContentsId, viewTitle); }); -function destroyBrowserView(webContentsId: WebContents['id']) { +function destroyBrowserView(webContentsId: Electron.WebContents['id']) { assertInteger(webContentsId, `Invalid webContentsId: ${webContentsId}`); ipcSend('destroy-browser-view', webContentsId); };