@tsonic/core 0.6.3 → 10.0.3

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/lang.d.ts CHANGED
@@ -169,6 +169,52 @@ export declare function nameof(expression: unknown): string;
169
169
  */
170
170
  export declare function trycast<T>(value: unknown): T | null;
171
171
 
172
+ /**
173
+ * Compile-time-only interface view.
174
+ *
175
+ * This is NOT a runtime cast. The compiler must erase this call before emitting C#.
176
+ *
177
+ * Primary use: treat a value as a CLR interface/nominal type for TypeScript type checking,
178
+ * without introducing runtime casts in emitted C# (important for EF Core precompilation).
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * import { asinterface } from "@tsonic/core/lang.js";
183
+ * import type { IQueryable } from "@tsonic/dotnet/System.Linq.js";
184
+ *
185
+ * const q = asinterface<IQueryable<User>>(db.Users);
186
+ * // q is typed as IQueryable<User> in TS, but emits without a cast in C#.
187
+ * ```
188
+ */
189
+ export declare function asinterface<T>(value: unknown): T;
190
+
191
+ /**
192
+ * Compile-time-only type selection marker.
193
+ *
194
+ * This is NOT a runtime type test. The compiler must erase this call before emitting C#.
195
+ *
196
+ * Primary use: specialize a single TypeScript overload implementation into one CLR method
197
+ * per signature (e.g., overriding a protected virtual overload family).
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * import { istype } from "@tsonic/core/lang.js";
202
+ * import type { int } from "@tsonic/core/types.js";
203
+ *
204
+ * // Overload signatures
205
+ * Foo(x: int): int;
206
+ * Foo(x: string): int;
207
+ *
208
+ * // Single implementation (compile-time specialized)
209
+ * Foo(p0: unknown): unknown {
210
+ * if (istype<int>(p0)) return p0 + 1;
211
+ * if (istype<string>(p0)) return p0.length;
212
+ * throw new Error("unreachable");
213
+ * }
214
+ * ```
215
+ */
216
+ export declare function istype<T>(value: unknown): value is T;
217
+
172
218
  // ============================================================================
173
219
  // Extension Method Intrinsics
174
220
  // ============================================================================
@@ -203,6 +249,6 @@ export type thisarg<T> = T;
203
249
  * Used as the return type of stackalloc.
204
250
  */
205
251
  export interface Span<T> {
206
- readonly length: int;
252
+ readonly Length: int;
207
253
  [index: number]: T;
208
254
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsonic/core",
3
- "version": "0.6.3",
4
- "description": "Core type definitions for Tsonic - TypeScript to native compiler",
3
+ "version": "10.0.3",
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
  }