warscript 0.0.1-dev.632c807 → 0.0.1-dev.aae5649

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ local ____exports = {}
7
7
  local ____ability_2Dtype = require("engine.object-data.entry.ability-type")
8
8
  local AbilityType = ____ability_2Dtype.AbilityType
9
9
  local ____arrays = require("utility.arrays")
10
- local EMPTY_ARRAY = ____arrays.EMPTY_ARRAY
10
+ local emptyArray = ____arrays.emptyArray
11
11
  local map = ____arrays.map
12
12
  local ____buff_2Dtype = require("engine.object-data.entry.buff-type")
13
13
  local BuffType = ____buff_2Dtype.BuffType
@@ -78,7 +78,7 @@ __TS__SetDescriptor(
78
78
  function(levelAbilityUpgrades)
79
79
  return levelAbilityUpgrades[i + 1]
80
80
  end
81
- ) or (abilityUpgrades[i + 1] or EMPTY_ARRAY)
81
+ ) or (abilityUpgrades[i + 1] or emptyArray())
82
82
  )
83
83
  end
84
84
  end
package/exception.d.ts CHANGED
@@ -15,3 +15,5 @@ export declare class IllegalStateException extends Exception {
15
15
  }
16
16
  export declare class CancellationException extends Exception {
17
17
  }
18
+ export declare class UnsupportedOperationException extends Exception {
19
+ }
package/exception.lua CHANGED
@@ -50,4 +50,8 @@ ____exports.CancellationException = __TS__Class()
50
50
  local CancellationException = ____exports.CancellationException
51
51
  CancellationException.name = "CancellationException"
52
52
  __TS__ClassExtends(CancellationException, ____exports.Exception)
53
+ ____exports.UnsupportedOperationException = __TS__Class()
54
+ local UnsupportedOperationException = ____exports.UnsupportedOperationException
55
+ UnsupportedOperationException.name = "UnsupportedOperationException"
56
+ __TS__ClassExtends(UnsupportedOperationException, ____exports.Exception)
53
57
  return ____exports
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "warscript",
4
- "version": "0.0.1-dev.632c807",
4
+ "version": "0.0.1-dev.aae5649",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",
@@ -25,7 +25,7 @@
25
25
  "@warscript/tstl-plugin": "^0.0.1",
26
26
  "typescript-to-lua": "^1.24.1",
27
27
  "lua-types": "^2.13.1",
28
- "warpack": "0.0.1-dev.559048d"
28
+ "warpack": "0.0.1-dev.5bdabe5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@typescript-eslint/eslint-plugin": "^5.59.11",
@@ -1,7 +1,7 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
2
  /** @noSelfInFile */
3
3
  import { TupleOf } from "./types";
4
- export declare const EMPTY_ARRAY: readonly any[];
4
+ export declare const emptyArray: <T>() => readonly T[];
5
5
  export declare const joinToString: <T>(array: readonly T[], separator: string, transform?: (element: T) => string) => string;
6
6
  export declare const arrayOfNotNull: <T>(...elements: readonly (T | null | undefined)[]) => T[];
7
7
  export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
@@ -8,7 +8,10 @@ local mathMin = math.min
8
8
  local select = _G.select
9
9
  local tableConcat = table.concat
10
10
  local tableSort = table.sort
11
- ____exports.EMPTY_ARRAY = {}
11
+ local EMPTY_ARRAY = {}
12
+ ____exports.emptyArray = function()
13
+ return EMPTY_ARRAY
14
+ end
12
15
  ____exports.joinToString = function(array, separator, transform)
13
16
  if transform == nil then
14
17
  transform = tostring
@@ -4,10 +4,25 @@ type IteratorState<T extends AnyNotNil> = {
4
4
  t: LuaMap<T, T>;
5
5
  n?: T;
6
6
  };
7
- export interface LinkedSet<T> extends LuaPairsKeyIterable<T> {
8
- readonly __linkedHashSet: unique symbol;
7
+ type OneSidedTypeGuard = {
8
+ readonly __oneSidedTypeGuard: unique symbol;
9
+ };
10
+ export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
11
+ copyOf(): LinkedSet<T>;
12
+ first(): T | undefined;
13
+ last(): T | undefined;
14
+ next(key: T): T | undefined;
15
+ previous(key: T): T | undefined;
16
+ contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
17
+ size: number;
18
+ forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
19
+ toArray(): T[];
20
+ sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
21
+ }
22
+ export interface LinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
23
+ readonly __linkedSet: unique symbol;
9
24
  }
10
- export declare class LinkedSet<T extends AnyNotNil> {
25
+ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet<T> {
11
26
  private n;
12
27
  private p;
13
28
  private f?;
@@ -20,9 +35,7 @@ export declare class LinkedSet<T extends AnyNotNil> {
20
35
  previous(key: T): T | undefined;
21
36
  add(key: T): boolean;
22
37
  remove(key: T): boolean;
23
- contains(key: AnyNotNil): key is T & {
24
- readonly __oneSidedTypeGuard: unique symbol;
25
- };
38
+ contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
26
39
  clear(): void;
27
40
  get size(): number;
28
41
  forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;