@tsonic/core 10.0.5 → 10.0.9
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 +65 -0
- package/lang.js +3 -0
- package/lang.js.d.ts +1 -0
- package/package.json +1 -1
- package/runtime/bindings.json +243 -34
- package/runtime/internal/index.d.ts +52 -38
- package/types.js +3 -0
- package/types.js.d.ts +1 -0
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
package/lang.js.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lang.d.ts";
|