@tsonic/core 10.0.5 → 10.0.10

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/lang.d.ts CHANGED
@@ -188,6 +188,28 @@ export declare function trycast<T>(value: unknown): T | null;
188
188
  */
189
189
  export declare function asinterface<T>(value: unknown): T;
190
190
 
191
+ /**
192
+ * Makes a CLR interface type implementable in TypeScript without requiring
193
+ * internal `__tsonic_iface_*` nominal brand fields.
194
+ *
195
+ * Use ONLY in `implements` clauses.
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * import type { Interface } from "@tsonic/core/lang.js";
200
+ * import type { IDesignTimeDbContextFactory } from "@tsonic/efcore/Microsoft.EntityFrameworkCore.Design.js";
201
+ *
202
+ * export class MyFactory implements Interface<IDesignTimeDbContextFactory<MyDbContext>> {
203
+ * CreateDbContext(_args: string[]): MyDbContext {
204
+ * return new MyDbContext();
205
+ * }
206
+ * }
207
+ * ```
208
+ */
209
+ export type Interface<T> = {
210
+ [K in keyof T as K extends `__tsonic_iface_${string}` ? never : K]: T[K];
211
+ };
212
+
191
213
  /**
192
214
  * Parameter passing modifiers (call-site markers).
193
215
  *
@@ -272,6 +294,49 @@ export declare function istype<T>(value: unknown): value is T;
272
294
  */
273
295
  export type thisarg<T> = T;
274
296
 
297
+ // ============================================================================
298
+ // Sticky Extension Scopes (used by generated bindings)
299
+ // ============================================================================
300
+
301
+ type __TsonicUnionToIntersection<T> =
302
+ (T extends unknown ? (k: T) => void : never) extends (k: infer I) => void ? I : never;
303
+
304
+ type __TsonicExtMapOf<T> = T extends { __tsonic_ext?: infer M } ? M : {};
305
+
306
+ type __TsonicExtApplierUnion<T> = __TsonicExtMapOf<T>[keyof __TsonicExtMapOf<T>];
307
+
308
+ type __TsonicApplyApplier<TApplier, TShape> =
309
+ TApplier extends { __tsonic_type: unknown }
310
+ ? (TApplier & { __tsonic_shape: TShape })["__tsonic_type"]
311
+ : never;
312
+
313
+ type __TsonicApplyAllAppliers<TReceiver, TShape> =
314
+ [__TsonicExtApplierUnion<TReceiver>] extends [never]
315
+ ? {}
316
+ : __TsonicUnionToIntersection<
317
+ __TsonicExtApplierUnion<TReceiver> extends infer A
318
+ ? A extends unknown
319
+ ? __TsonicApplyApplier<A, TShape>
320
+ : never
321
+ : never
322
+ >;
323
+
324
+ type __TsonicExtCarrier<TReceiver> =
325
+ TReceiver extends { __tsonic_ext?: infer M } ? { __tsonic_ext?: M } : {};
326
+
327
+ /**
328
+ * Rewrap a return shape with the extension scopes that were in scope on the receiver.
329
+ *
330
+ * This is used by generated `ExtensionMethods_*` typings so fluent chains keep the same
331
+ * extension namespaces "sticky" (similar to C# `using` semantics).
332
+ *
333
+ * This is compile-time-only. There is no runtime behavior.
334
+ */
335
+ export type Rewrap<TReceiver, TNewShape> =
336
+ TNewShape extends null | undefined ? TNewShape
337
+ : TNewShape extends void ? void
338
+ : TNewShape & __TsonicExtCarrier<TReceiver> & __TsonicApplyAllAppliers<TReceiver, TNewShape>;
339
+
275
340
  // ============================================================================
276
341
  // Span type (for stackalloc return type)
277
342
  // ============================================================================
package/lang.js ADDED
@@ -0,0 +1,3 @@
1
+ // Runtime stub for @tsonic/core/lang.js
2
+ // Tsonic erases these imports during compilation.
3
+ export {};
package/lang.js.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./lang.d.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsonic/core",
3
- "version": "10.0.5",
3
+ "version": "10.0.10",
4
4
  "description": "Core type definitions for Tsonic (versioned by .NET major)",
5
5
  "type": "module",
6
6
  "keywords": [
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // Runtime stub for @tsonic/core/types.js
2
+ // Tsonic erases these imports during compilation.
3
+ export {};
package/types.js.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./types.d.ts";