@tsonic/core 0.6.2 → 10.0.1

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.
package/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Core type definitions for Tsonic - a TypeScript to native compiler.
4
4
 
5
+ ## Versioning
6
+
7
+ This repo is versioned by **.NET major**:
8
+
9
+ - **.NET 10** → `versions/10/` → npm: `@tsonic/core@10.x`
10
+
11
+ When publishing, run: `npm publish versions/10 --access public`
12
+
5
13
  ## Installation
6
14
 
7
15
  ```bash
package/attributes.d.ts CHANGED
@@ -25,11 +25,46 @@ export type Ctor<T = unknown, Args extends readonly any[] = readonly any[]> = ne
25
25
  /** Any attribute class constructor. */
26
26
  export type AttributeCtor = Ctor<object, readonly any[]>;
27
27
 
28
+ /**
29
+ * Extract constructor parameters across multiple overloads.
30
+ *
31
+ * TypeScript's built-in ConstructorParameters<C> collapses overloads to the
32
+ * last signature, which makes attribute ctor typing unusably strict for many
33
+ * .NET attributes.
34
+ */
35
+ export type OverloadedConstructorParameters<C extends AttributeCtor> =
36
+ C extends {
37
+ new (...args: infer A1): any;
38
+ new (...args: infer A2): any;
39
+ new (...args: infer A3): any;
40
+ new (...args: infer A4): any;
41
+ new (...args: infer A5): any;
42
+ }
43
+ ? A1 | A2 | A3 | A4 | A5
44
+ : C extends {
45
+ new (...args: infer A1): any;
46
+ new (...args: infer A2): any;
47
+ new (...args: infer A3): any;
48
+ new (...args: infer A4): any;
49
+ }
50
+ ? A1 | A2 | A3 | A4
51
+ : C extends {
52
+ new (...args: infer A1): any;
53
+ new (...args: infer A2): any;
54
+ new (...args: infer A3): any;
55
+ }
56
+ ? A1 | A2 | A3
57
+ : C extends { new (...args: infer A1): any; new (...args: infer A2): any }
58
+ ? A1 | A2
59
+ : C extends { new (...args: infer A): any }
60
+ ? A
61
+ : never;
62
+
28
63
  /** Attribute application (constructor + ctor arguments). */
29
64
  export interface AttributeDescriptor<C extends AttributeCtor = AttributeCtor> {
30
65
  readonly kind: "attribute";
31
66
  readonly ctor: C;
32
- readonly args: readonly ConstructorParameters<C>;
67
+ readonly args: readonly OverloadedConstructorParameters<C>;
33
68
  }
34
69
 
35
70
  /** Extract instance type of a constructor. */
@@ -107,7 +142,7 @@ export interface AttributeTargetBuilder {
107
142
  */
108
143
  add<C extends AttributeCtor>(
109
144
  ctor: C,
110
- ...args: ConstructorParameters<C>
145
+ ...args: OverloadedConstructorParameters<C>
111
146
  ): void;
112
147
 
113
148
  /**
@@ -147,7 +182,7 @@ export interface AttributesApi {
147
182
  */
148
183
  attr<C extends AttributeCtor>(
149
184
  ctor: C,
150
- ...args: ConstructorParameters<C>
185
+ ...args: OverloadedConstructorParameters<C>
151
186
  ): AttributeDescriptor<C>;
152
187
  }
153
188
 
package/lang.d.ts CHANGED
@@ -203,6 +203,6 @@ export type thisarg<T> = T;
203
203
  * Used as the return type of stackalloc.
204
204
  */
205
205
  export interface Span<T> {
206
- readonly length: int;
206
+ readonly Length: int;
207
207
  [index: number]: T;
208
208
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsonic/core",
3
- "version": "0.6.2",
4
- "description": "Core type definitions for Tsonic - TypeScript to native compiler",
3
+ "version": "10.0.1",
4
+ "description": "Core type definitions for Tsonic (versioned by .NET major)",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "typescript",
@@ -11,7 +11,8 @@
11
11
  "primitives",
12
12
  "interop",
13
13
  "csharp",
14
- "tsonic"
14
+ "tsonic",
15
+ "net10"
15
16
  ],
16
17
  "author": "Tsonic Team",
17
18
  "license": "MIT",
@@ -22,5 +23,8 @@
22
23
  "bugs": {
23
24
  "url": "https://github.com/tsoniclang/core/issues"
24
25
  },
25
- "homepage": "https://github.com/tsoniclang/core#readme"
26
+ "homepage": "https://github.com/tsoniclang/core#readme",
27
+ "peerDependencies": {
28
+ "@tsonic/dotnet": "^10.0.1"
29
+ }
26
30
  }