diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index 738e3fb..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,561 +0,0 @@ -import { EventMap, EventEmitter } from '@war3js/events'; -export { TextDecoder, TextEncoder } from 'text-decoding'; -import { Headers } from '@war3js/headers-polyfill'; -export { Headers } from '@war3js/headers-polyfill'; - -declare class Console { - trace(...args: any): void; - debug(...args: any): void; - info(...args: any): void; - warn(...args: any): void; - error(...args: any): void; - log(...args: any): void; -} - -type HandleConstructor = new (handle: HandleHolder) => H; -interface HandleEventMap extends EventMap { - error: (error: Error) => void; - remove: () => void; -} -declare class Handle extends EventEmitter { - #private; - constructor(handleHolder: Handle | HandleHolder); - get handle(): HandleHolder; - equals(anotherHandle: Handle): boolean; -} - -interface Ability { - get handle(): HandleHolder<"ability">; -} -declare class Ability extends Handle { - constructor(itemHandle: HandleHolder<"ability">); - constructor(itemHandle: Ability); - constructor(abilCode: number); -} - -interface AbilityLevelAccessorNatives { - get: (ability: HandleHolder<"ability">, field: HandleHolder<"_enum">, level: number) => T; - set: (ability: HandleHolder<"ability">, field: HandleHolder<"_enum">, level: number, value: T) => boolean; - baseGet: (abilId: number, field: HandleHolder<"_enum">, level: number) => T; - baseSet: (ability: number, field: HandleHolder<"_enum">, level: number, value: T) => boolean; -} -declare class AbilityLevelAccessor implements Iterable { - #private; - constructor(abilityData: AbilityData, field: HandleHolder<"_enum">, accessNatives: AbilityLevelAccessorNatives); - [Symbol.iterator](): Iterator; - getLength(): number; - getIndexValue(index: number): T; - setIndexValue(index: number, value: T): boolean; -} -interface AbilityData { - instance: number | Ability; -} -declare class AbilityData { - #private; - constructor(instance: number | Ability); -} - -interface IndexAccessArray extends Iterable { - [key: number]: T; - [key: string]: any; - [key: symbol]: any; -} - -interface WidgetEventMap extends HandleEventMap { - death: (event: any) => void; - damaging: () => void; - damaged: () => void; -} -declare class Widget extends Handle { - constructor(handleHolder: HandleHolder<"widget" | "unit" | "item" | "destructable"> | Widget); -} - -interface PlayerEventMap extends HandleEventMap { -} -interface Player { - get handle(): HandleHolder<"player">; -} -declare class Player extends Handle { - constructor(handleHolder: HandleHolder<"player">); - static getById(slot: number): T; - static localPlayer(): T; -} - -interface DestructableEventMap extends WidgetEventMap { -} -declare class Destructable extends Widget { - constructor(destructableHandle: HandleHolder<"item">); - constructor(destructableHandle: Destructable); - constructor(destructableId: number, x: number, y: number, face: number, scale: number, variation: number); -} - -interface ItemEventMap extends WidgetEventMap { -} -declare class Item extends Widget { - constructor(itemHandle: HandleHolder<"item">); - constructor(itemHandle: Item); - constructor(itemId: number, x: number, y: number); -} - -type HUnitEvent = HandleHolder<"unitevent">; -type HTrigger = HandleHolder<"trigger">; -type HTriggerAction = HandleHolder<"triggeraction">; -type HEvent = HandleHolder<"event">; -type HUnitState = HandleHolder<"unitstate">; -type HLocation = HandleHolder<"location">; -type HBuff = HandleHolder<"buff">; -type HAbility = HandleHolder<"ability">; -type HProjectile = HandleHolder<"projectile">; -type JassCodeCallback = () => number | void; - -type UnitEventType = keyof typeof stringToHandle; -declare const stringToHandle: { - damaged: HUnitEvent; - damaging: HUnitEvent; - selected: HUnitEvent; - deselected: HUnitEvent; - death: HUnitEvent; - decay: HUnitEvent; - detected: HUnitEvent; - hidden: HUnitEvent; - stateLimit: HUnitEvent; - acquiredTarget: HUnitEvent; - targetInRange: HUnitEvent; - attacked: HUnitEvent; - rescued: HUnitEvent; - constructCancel: HUnitEvent; - constructFinish: HUnitEvent; - upgradeStart: HUnitEvent; - upgradeCancel: HUnitEvent; - upgradeFinish: HUnitEvent; - trainStart: HUnitEvent; - trainCancel: HUnitEvent; - trainFinish: HUnitEvent; - researchStart: HUnitEvent; - researchCancel: HUnitEvent; - researchFinish: HUnitEvent; - issuedOrder: HUnitEvent; - issuedPointOrder: HUnitEvent; - issuedTargetOrder: HUnitEvent; - heroLevel: HUnitEvent; - heroSkill: HUnitEvent; - heroRevivable: HUnitEvent; - heroReviveStart: HUnitEvent; - heroReviveCancel: HUnitEvent; - heroReviveFinish: HUnitEvent; - summon: HUnitEvent; - dropItem: HUnitEvent; - pickupItem: HUnitEvent; - useItem: HUnitEvent; - loaded: HUnitEvent; - attackFinished: HUnitEvent; - decayFinished: HUnitEvent; - buffReceived: HUnitEvent; - buffRefreshed: HUnitEvent; - buffEnded: HUnitEvent; - projectileLaunch: HUnitEvent; - projectileHit: HUnitEvent; - abilityAdded: HUnitEvent; - abilityRemoved: HUnitEvent; - abilityAutocastOn: HUnitEvent; - abilityAutocastOff: HUnitEvent; - spellChannel: HUnitEvent; - spellCast: HUnitEvent; - spellEffect: HUnitEvent; - spellFinish: HUnitEvent; - spellEndcast: HUnitEvent; -}; - -declare class TriggerEvent { - readonly event: E; - constructor(event: E); -} - -declare class TriggerUnitEvent extends TriggerEvent { - readonly triggerUnit: Unit; - constructor(event: E); -} - -declare class UnitEventDeath extends TriggerUnitEvent<"death"> { - readonly killingUnit: Unit; - constructor(); -} - -declare class UnitEventDetected extends TriggerUnitEvent<"detected"> { - readonly detectingPlayer: Player; - constructor(); -} - -declare class UnitEventAcquiredTarget extends TriggerUnitEvent<"acquiredTarget"> { - readonly target: Unit; - constructor(); -} - -declare class UnitEventTargetInRange extends TriggerUnitEvent<"targetInRange"> { - readonly target: Unit; - constructor(); -} - -declare class UnitEventAttacked extends TriggerUnitEvent<"attacked"> { - readonly attacker: Unit; - constructor(); -} - -declare class UnitEventRescued extends TriggerUnitEvent<"rescued"> { - readonly rescuer: Unit; - constructor(); -} - -declare class UnitEventConstructFinish extends TriggerUnitEvent<"constructFinish"> { - readonly constructedStructure: Unit; - constructor(); -} - -declare class UnitEventTrainStart extends TriggerUnitEvent<"trainStart"> { - readonly trainedUnitType: number; - constructor(); -} - -declare class UnitEventTrainCancel extends TriggerUnitEvent<"trainCancel"> { - readonly trainedUnitType: number; - constructor(); -} - -declare class UnitEventTrainFinish extends TriggerUnitEvent<"trainFinish"> { - readonly trainedUnit: Unit; - constructor(); -} - -declare class UnitEventResearchStart extends TriggerUnitEvent<"researchStart"> { - readonly researched: number; - constructor(); -} - -declare class UnitEventResearchCancel extends TriggerUnitEvent<"researchCancel"> { - readonly researched: number; - constructor(); -} - -declare class UnitEventResearchFinish extends TriggerUnitEvent<"researchFinish"> { - readonly researched: number; - constructor(); -} - -declare class UnitEventIssuedOrder extends TriggerUnitEvent<"issuedOrder"> { - readonly issuedOrderId: number; - constructor(); -} - -declare class UnitEventIssuedPointOrder extends TriggerUnitEvent<"issuedPointOrder"> { - readonly issuedOrderId: number; - readonly orderPointX: number; - readonly orderPointY: number; - constructor(); -} - -declare class UnitEventIssuedTargetOrder extends TriggerUnitEvent<"issuedTargetOrder"> { - readonly issuedOrderId: number; - readonly orderTarget: Widget; - constructor(); -} - -declare class UnitEventHeroSkill extends TriggerUnitEvent<"heroSkill"> { - readonly learnedSkill: number; - readonly learnedSkillLevel: number; - constructor(); -} - -declare class UnitEventHeroRevivable extends TriggerUnitEvent<"heroRevivable"> { - readonly revivableUnit: Unit; - constructor(); -} - -declare class UnitEventHeroReviveStart extends TriggerUnitEvent<"heroReviveStart"> { - readonly revivingUnit: Unit; - constructor(); -} - -declare class UnitEventHeroReviveCancel extends TriggerUnitEvent<"heroReviveCancel"> { - readonly revivingUnit: Unit; - constructor(); -} - -declare class UnitEventHeroReviveFinish extends TriggerUnitEvent<"heroReviveFinish"> { - readonly revivingUnit: Unit; - constructor(); -} - -declare class UnitEventSummon extends TriggerUnitEvent<"summon"> { - readonly summonedUnit: Unit; - constructor(); -} - -declare class UnitEventDropItem extends TriggerUnitEvent<"dropItem"> { - readonly droppedItem: Item; - constructor(); -} - -declare class UnitEventPickupItem extends TriggerUnitEvent<"pickupItem"> { - readonly pickedupItem: Item; - constructor(); -} - -declare class UnitEventUseItem extends TriggerUnitEvent<"useItem"> { - readonly usedItem: Item; - constructor(); -} - -declare class UnitEventLoaded extends TriggerUnitEvent<"loaded"> { - readonly transport: Unit; - constructor(); -} - -declare class UnitEventStateLimit extends TriggerUnitEvent<"stateLimit"> { - readonly eventUnitState: HUnitState; - constructor(); -} - -interface IDisposable { - dispose: () => void; -} - -declare const enum UnitState { - Life = 0, - MaxLife = 1, - Mana = 2, - MaxMana = 3 -} -declare const enum LimitOp { - lt = 0, - le = 1, - eq = 2, - gt = 3, - ge = 4 -} -declare class UnitStateEmiter implements IDisposable { - #private; - constructor(target: Unit, unitState: UnitState, limitOp: LimitOp, value: number); - get unitState(): UnitState; - get limitOp(): LimitOp; - get value(): number; - get emitSymbol(): StateEventSymbol; - dispose(): void; -} - -declare class UnitEventBuffReceived extends TriggerUnitEvent<"buffReceived"> { - readonly recievedBuff: HBuff; - readonly sourceAbility: HAbility; - readonly sourceUnit: Unit; - constructor(); -} - -declare class UnitEventBuffRefreshed extends TriggerUnitEvent<"buffRefreshed"> { - readonly recievedBuff: HBuff; - readonly sourceAbility: HAbility; - readonly sourceUnit: Unit; - constructor(); -} - -declare class UnitEventBuffEnded extends TriggerUnitEvent<"buffEnded"> { - readonly recievedBuff: HBuff; - readonly sourceAbility: HAbility; - readonly sourceUnit: Unit; - constructor(); -} - -declare class UnitEventProjectileLaunch extends TriggerUnitEvent<"projectileLaunch"> { - readonly target: Widget; - readonly projecitle: HProjectile; - constructor(); -} - -declare class UnitEventProjectileHit extends TriggerUnitEvent<"projectileHit"> { - readonly source: Unit; - readonly projectile: HProjectile; - constructor(); -} - -declare class UnitEventSpellChannel extends TriggerUnitEvent<"spellChannel"> { - readonly abilityId: number; - readonly ability: HAbility; - readonly targetX: number; - readonly targetY: number; - readonly targetDestructable: Destructable; - readonly targetItem: Item; - readonly targetUnit: Unit; - constructor(); -} - -declare class UnitEventSpellCast extends TriggerUnitEvent<"spellCast"> { - readonly abilityId: number; - readonly ability: HAbility; - readonly targetX: number; - readonly targetY: number; - readonly targetDestructable: Destructable; - readonly targetItem: Item; - readonly targetUnit: Unit; - constructor(); -} - -declare class UnitEventSpellEffect extends TriggerUnitEvent<"spellEffect"> { - readonly abilityId: number; - readonly ability: HAbility; - readonly targetX: number; - readonly targetY: number; - readonly targetDestructable: Destructable; - readonly targetItem: Item; - readonly targetUnit: Unit; - constructor(); -} - -declare class UnitEventSpellFinish extends TriggerUnitEvent<"spellFinish"> { - readonly abilityId: number; - readonly ability: HAbility; - readonly targetX: number; - readonly targetY: number; - readonly targetDestructable: Destructable; - readonly targetItem: Item; - readonly targetUnit: Unit; - constructor(); -} - -declare class UnitEventSpellEndcast extends TriggerUnitEvent<"spellEndcast"> { - readonly abilityId: number; - readonly ability: HAbility; - readonly targetX: number; - readonly targetY: number; - readonly targetDestructable: Destructable; - readonly targetItem: Item; - readonly targetUnit: Unit; - constructor(); -} - -declare const stateEvent: unique symbol; -type StateEventSymbol = typeof stateEvent; -interface UnitEventMap extends WidgetEventMap { - selected: (event: TriggerUnitEvent<"selected">) => void; - deselected: (event: TriggerUnitEvent<"deselected">) => void; - damaged: () => void; - damaging: () => void; - death: (event: UnitEventDeath) => void; - decay: (event: TriggerUnitEvent<"decay">) => void; - detected: (event: UnitEventDetected) => void; - hidden: (event: TriggerUnitEvent<"hidden">) => void; - stateLimit: (event: UnitEventStateLimit) => void; - acquiredTarget: (event: UnitEventAcquiredTarget) => void; - targetInRange: (event: UnitEventTargetInRange) => void; - attacked: (event: UnitEventAttacked) => void; - rescued: (event: UnitEventRescued) => void; - constructCancel: (event: TriggerUnitEvent<"constructCancel">) => void; - constructFinish: (event: UnitEventConstructFinish) => void; - upgradeStart: (event: TriggerUnitEvent<"upgradeStart">) => void; - upgradeCancel: (event: TriggerUnitEvent<"upgradeCancel">) => void; - upgradeFinish: (event: TriggerUnitEvent<"upgradeFinish">) => void; - trainStart: (event: UnitEventTrainStart) => void; - trainCancel: (event: UnitEventTrainCancel) => void; - trainFinish: (event: UnitEventTrainFinish) => void; - researchStart: (event: UnitEventResearchStart) => void; - researchCancel: (event: UnitEventResearchCancel) => void; - researchFinish: (event: UnitEventResearchFinish) => void; - issuedOrder: (event: UnitEventIssuedOrder) => void; - issuedPointOrder: (event: UnitEventIssuedPointOrder) => void; - issuedTargetOrder: (event: UnitEventIssuedTargetOrder) => void; - heroLevel: (event: TriggerUnitEvent<"heroLevel">) => void; - heroSkill: (event: UnitEventHeroSkill) => void; - heroRevivable: (event: UnitEventHeroRevivable) => void; - heroReviveStart: (event: UnitEventHeroReviveStart) => void; - heroReviveCancel: (event: UnitEventHeroReviveCancel) => void; - heroReviveFinish: (event: UnitEventHeroReviveFinish) => void; - summon: (event: UnitEventSummon) => void; - dropItem: (event: UnitEventDropItem) => void; - pickupItem: (event: UnitEventPickupItem) => void; - useItem: (event: UnitEventUseItem) => void; - loaded: (event: UnitEventLoaded) => void; - attackFinished: (event: TriggerUnitEvent<"attackFinished">) => void; - decayFinished: (event: TriggerUnitEvent<"decayFinished">) => void; - buffReceived: (event: UnitEventBuffReceived) => void; - buffRefreshed: (event: UnitEventBuffRefreshed) => void; - buffEnded: (event: UnitEventBuffEnded) => void; - projectileLaunch: (event: UnitEventProjectileLaunch) => void; - projectileHit: (event: UnitEventProjectileHit) => void; - abilityAdded: (event: TriggerUnitEvent<"abilityAdded">) => void; - abilityRemoved: (event: TriggerUnitEvent<"abilityRemoved">) => void; - abilityAutocastOn: (event: TriggerUnitEvent<"abilityAutocastOn">) => void; - abilityAutocastOff: (event: TriggerUnitEvent<"abilityAutocastOff">) => void; - spellChannel: (event: UnitEventSpellChannel) => void; - spellCast: (event: UnitEventSpellCast) => void; - spellEffect: (event: UnitEventSpellEffect) => void; - spellFinish: (event: UnitEventSpellFinish) => void; - spellEndcast: (event: UnitEventSpellEndcast) => void; - [stateEvent]: (event: UnitEventStateLimit, emiter: UnitStateEmiter) => void; -} -type UnitOptions = { - type: "building"; - isAutoBuild?: boolean; - workersCanAssist?: boolean; -} | { - type: "illusion"; -} | { - type: "corpse"; -}; -type UnitIllusionOptions = { - copyPassives: boolean; -}; -interface Unit { - get handle(): HandleHolder<"unit">; -} -declare class Unit extends Widget { - constructor(unitHandle: HandleHolder<"unit">); - constructor(unitobject: Unit); - constructor(unitobject: Player, unitId: number, x: number, y: number, facing: number); - onUnitState(unitState: UnitState, limitOp: LimitOp, value: number, callback: UnitEventMap[StateEventSymbol]): UnitStateEmiter; - static createIllusionFromUnit(unit: Unit, options?: UnitIllusionOptions): Unit; - onEmitterAddListener(event: UnitEventType | number | symbol, listener: (...args: any[]) => void): void; -} - -interface WebsocketEvents extends EventMap { - open: () => void; - message: (message: string | ArrayBuffer) => void; -} -declare class Websocket extends EventEmitter { - #private; - static CONNECTING: number; - static OPEN: number; - static CLOSING: number; - static CLOSED: number; - get readyState(): number; - get bufferedAmount(): number; - constructor(url: string, headers?: Headers); - send(message: string | ArrayBuffer | Uint8Array): void; - close(code?: number, reason?: string): void; -} - -declare const stream: any; -declare const buffer: any; -declare const isUjApi: boolean; -declare const console: Console; - -declare global { - /** - * A low-level object that replaces the handle type in war3js. - * It is not recommended to use it as an object, as some fields may start to be used by the war3js backend. - */ - interface HandleHolder { - /** - * Returns jass handle type. For fake handles this is _enum. - */ - get type(): T; - /** - * The library object this handle is bound to - */ - payload: P; - /** - * Compares handle's internal pointers as numbers. ``null`` is interpreted as 0 - * @param handle another handle for compare - * @returns true if jass - */ - equals: (handle: HandleHolder | null) => boolean; - } -} - -export { AbilityData, AbilityLevelAccessor, type AbilityLevelAccessorNatives, Destructable, type DestructableEventMap, type HEvent, type HLocation, type HTrigger, type HTriggerAction, type HUnitEvent, type HUnitState, Handle, type HandleConstructor, type HandleEventMap, type IndexAccessArray, Item, type ItemEventMap, type JassCodeCallback, LimitOp, Player, type PlayerEventMap, type StateEventSymbol, Unit, type UnitEventMap, type UnitIllusionOptions, type UnitOptions, UnitState, Websocket, Widget, type WidgetEventMap, buffer, console, isUjApi, stream }; diff --git a/src/handles/Ability.ts b/src/handles/Ability.ts index c482ceb..4d60081 100644 --- a/src/handles/Ability.ts +++ b/src/handles/Ability.ts @@ -1,3 +1,4 @@ +import { HandleHolder } from "@war3js/unsafe"; import { CreateAbilityNe } from "../utils/common.js"; import { Handle, HandleEventMap } from "./Handle.js"; diff --git a/src/handles/Destructable.ts b/src/handles/Destructable.ts index aa3fc5e..5c8dbed 100644 --- a/src/handles/Destructable.ts +++ b/src/handles/Destructable.ts @@ -1,3 +1,4 @@ +import { HandleHolder } from "@war3js/unsafe"; import { CreateDestructableNe } from "../utils/common.js"; import { Widget, WidgetEventMap } from "./Widget.js"; diff --git a/src/handles/Handle.ts b/src/handles/Handle.ts index abd5a9a..565bd0b 100644 --- a/src/handles/Handle.ts +++ b/src/handles/Handle.ts @@ -1,4 +1,5 @@ import { EventMap, EventEmitter } from "@war3js/events"; +import { HandleHolder } from "@war3js/unsafe"; export type HandleConstructor = new ( handle: HandleHolder, diff --git a/src/handles/Item.ts b/src/handles/Item.ts index 69f9d59..c143672 100644 --- a/src/handles/Item.ts +++ b/src/handles/Item.ts @@ -1,5 +1,6 @@ import { Widget, WidgetEventMap } from "./Widget.js"; import { CreateItemNe } from "../utils/common.js"; +import { HandleHolder } from "@war3js/unsafe"; export interface ItemEventMap extends WidgetEventMap {} diff --git a/src/handles/Player.ts b/src/handles/Player.ts index 4a527d3..2808d89 100644 --- a/src/handles/Player.ts +++ b/src/handles/Player.ts @@ -1,3 +1,4 @@ +import { HandleHolder } from "@war3js/unsafe"; import { PlayerNative, GetLocalPlayer } from "../utils/common.js"; import { Handle, HandleEventMap } from "./Handle.js"; diff --git a/src/handles/Unit.ts b/src/handles/Unit.ts index e55cbb8..e033bed 100644 --- a/src/handles/Unit.ts +++ b/src/handles/Unit.ts @@ -50,6 +50,7 @@ import { UnitEventSpellCast } from "../triggerEvents/unit/UnitEventSpellCast.js" import { UnitEventSpellEffect } from "../triggerEvents/unit/UnitEventSpellEffect.js"; import { UnitEventSpellFinish } from "../triggerEvents/unit/UnitEventSpellFinish.js"; import { UnitEventSpellEndcast } from "../triggerEvents/unit/UnitEventSpellEndcast.js"; +import { HandleHolder } from "@war3js/unsafe"; const eventUnitEmiter = unitEmiter; diff --git a/src/handles/Widget.ts b/src/handles/Widget.ts index ab7cae1..d31752a 100644 --- a/src/handles/Widget.ts +++ b/src/handles/Widget.ts @@ -1,3 +1,4 @@ +import { HandleHolder } from "@war3js/unsafe"; import { Handle, HandleEventMap } from "./Handle.js"; export interface WidgetEventMap extends HandleEventMap { diff --git a/src/handles/instanceApi/AbilityData.ts b/src/handles/instanceApi/AbilityData.ts index e9e3b30..131f374 100644 --- a/src/handles/instanceApi/AbilityData.ts +++ b/src/handles/instanceApi/AbilityData.ts @@ -1,4 +1,5 @@ /* eslint-disable matching-export-value-to-file-name */ +import { HandleHolder } from "@war3js/unsafe"; import { ABILITY_IF_LEVELS, GetAbilityBaseIntegerFieldById, GetAbilityIntegerField } from "../../utils/common.js"; import { Ability } from "../Ability.js"; diff --git a/src/index.ts b/src/index.ts index d10ef01..c079a91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,29 +85,3 @@ export { export { UnitState, LimitOp } from "./services/emitters/UnitStateEmiter.js"; export { Websocket } from "./services/websocket/Websocket.js"; - -// -- ONLY FOR dts-bundle - -declare global { - /** - * A low-level object that replaces the handle type in war3js. - * It is not recommended to use it as an object, as some fields may start to be used by the war3js backend. - */ - interface HandleHolder { - /** - * Returns jass handle type. For fake handles this is _enum. - */ - get type(): T; - /** - * The library object this handle is bound to - */ - payload: P; - - /** - * Compares handle's internal pointers as numbers. ``null`` is interpreted as 0 - * @param handle another handle for compare - * @returns true if jass - */ - equals: (handle: HandleHolder | null) => boolean; - } -} diff --git a/src/services/ClassBuilder.ts b/src/services/ClassBuilder.ts index 5d8e844..2d0a8bd 100644 --- a/src/services/ClassBuilder.ts +++ b/src/services/ClassBuilder.ts @@ -1,4 +1,4 @@ -import { getNativeByName, getListNatives, getGlobalsKeys, getGlobal } from "@war3js/unsafe"; +import { getNativeByName, getListNatives, getGlobalsKeys, getGlobal, HandleHolder } from "@war3js/unsafe"; import { Handle } from "../handles/Handle.js"; import { toHandleHolderSoft } from "../utils/ToHandleHolder.js"; import { fromHandleHolderSoft } from "../utils/FromHandleHolder.js"; diff --git a/src/services/NativeEvents.ts b/src/services/NativeEvents.ts index 85066d3..0502b63 100644 --- a/src/services/NativeEvents.ts +++ b/src/services/NativeEvents.ts @@ -1,6 +1,6 @@ import { EventEmitter, EventMap } from "@war3js/events"; -import { setOnNewHandle, setOnHandleDestroy } from "@war3js/unsafe"; +import { setOnNewHandle, setOnHandleDestroy, HandleHolder } from "@war3js/unsafe"; export interface NativeEventsEventMap extends EventMap { newHandle: (handle: HandleHolder, constructorNative: string) => void; diff --git a/src/utils/ToHandleHolder.ts b/src/utils/ToHandleHolder.ts index 34134a9..29eaea6 100644 --- a/src/utils/ToHandleHolder.ts +++ b/src/utils/ToHandleHolder.ts @@ -1,3 +1,4 @@ +import { HandleHolder } from "@war3js/unsafe"; import { Handle } from "../handles/Handle.js"; export function toHandleHolderSoft(value: any): HandleHolder | null | undefined { diff --git a/src/utils/common.ts b/src/utils/common.ts index 3a94e68..98b488c 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,4 +1,4 @@ -import { getNativeByName, getGlobal } from "@war3js/unsafe"; +import { getNativeByName, getGlobal, HandleHolder } from "@war3js/unsafe"; import { Unit } from "../handles/Unit.js"; import { Player } from "../handles/Player.js"; import { Widget } from "../handles/Widget.js"; diff --git a/tsup.config.ts b/tsup.config.ts index e5c0daa..753e977 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -13,6 +13,6 @@ export default defineConfig([ dts: true, target: "es5", tsconfig: "./tsconfig.build.json", - noExternal: ["@war3js/events", "text-decoding", "@war3js/headers-polyfill"], + noExternal: ["@war3js/events", "@war3js/unsafe", "text-decoding", "@war3js/headers-polyfill"], }, ]);