@tsonic/globals 0.3.4 → 0.3.6

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.
Files changed (2) hide show
  1. package/index.d.ts +21 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -17,29 +17,42 @@ import {
17
17
  Boolean$instance, __Boolean$views,
18
18
  Object$instance
19
19
  } from "@tsonic/dotnet/System/internal/index.js";
20
- import { IList_1, ICollection_1, IEnumerable_1, IReadOnlyList_1, IReadOnlyCollection_1 } from "@tsonic/dotnet/System.Collections.Generic/internal/index.js";
20
+ import { IEnumerable_1 } from "@tsonic/dotnet/System.Collections.Generic/internal/index.js";
21
21
 
22
22
  declare global {
23
23
  /**
24
- * Array<T> - Synthesized generic array type
24
+ * Array<T> - C# array type (T[])
25
25
  *
26
- * Combines:
26
+ * C# arrays are fixed-size and do NOT have IList<T>/ICollection<T> instance methods.
27
+ * They only support:
27
28
  * - System.Array instance methods (length, rank, clone, copyTo, etc.)
28
- * - Generic collection interfaces (IList<T>, ICollection<T>, IEnumerable<T>)
29
- * - TypeScript indexer and iterator
29
+ * - IEnumerable<T> for iteration (foreach)
30
+ * - Indexer access
30
31
  *
31
- * This gives arrays full BCL method support.
32
+ * For mutable collection operations (add, remove, etc.), use List<T> instead.
33
+ * For LINQ operations (map, filter, etc.), use Enumerable methods.
32
34
  */
33
- interface Array<T> extends Array$instance, __Array$views, IList_1<T>, ICollection_1<T>, IEnumerable_1<T>, IReadOnlyList_1<T>, IReadOnlyCollection_1<T> {
35
+ interface Array<T> extends Array$instance, __Array$views, IEnumerable_1<T> {
34
36
  [n: number]: T;
35
37
  [Symbol.iterator](): IterableIterator<T>;
36
38
  }
37
39
 
38
- interface ReadonlyArray<T> extends Array$instance, __Array$views, IReadOnlyList_1<T>, IReadOnlyCollection_1<T>, IEnumerable_1<T> {
40
+ interface ReadonlyArray<T> extends Array$instance, __Array$views, IEnumerable_1<T> {
39
41
  readonly [n: number]: T;
40
42
  [Symbol.iterator](): IterableIterator<T>;
41
43
  }
42
44
 
45
+ /**
46
+ * ArrayConstructor - allows new Array<T>(size) syntax
47
+ * In dotnet mode: emits as new T[size]
48
+ * In js mode: emits as new List<T>() with capacity
49
+ */
50
+ interface ArrayConstructor {
51
+ new <T>(size?: number): T[];
52
+ }
53
+
54
+ const Array: ArrayConstructor;
55
+
43
56
  /**
44
57
  * String - augmented with BCL methods from System.String
45
58
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsonic/globals",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Global type definitions for Tsonic with BCL primitive methods",
5
5
  "main": "index.d.ts",
6
6
  "types": "index.d.ts",