@tsonic/core 10.0.10 → 10.0.12

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.
@@ -9,11 +9,15 @@ import type { sbyte, byte, short, ushort, int, uint, long, ulong, int128, uint12
9
9
  import type { ptr } from "@tsonic/core/types.js";
10
10
 
11
11
  // Import types from other namespaces
12
- import type { Dictionary, IEnumerable, IList } from "@tsonic/dotnet/System.Collections.Generic.js";
13
- import * as System_Internal from "@tsonic/dotnet/System.js";
14
- import type { Action, Boolean as ClrBoolean, Func, IEquatable, Int32, Object as ClrObject, String as ClrString, Type, ValueType, Void } from "@tsonic/dotnet/System.js";
12
+ import type { Dictionary_2, IEnumerable_1, IList_1 } from "@tsonic/dotnet/System.Collections.Generic/internal/index.js";
13
+ import * as System_Internal from "@tsonic/dotnet/System/internal/index.js";
14
+ import type { Action_1, Boolean as ClrBoolean, Func_2, IEquatable_1, Int32, Object as ClrObject, String as ClrString, Type, ValueType, Void } from "@tsonic/dotnet/System/internal/index.js";
15
15
 
16
16
  export interface IteratorResult_1$instance<T> {
17
+ readonly __tsonic_type_Tsonic_Runtime_IteratorResult_1: never;
18
+
19
+ readonly __tsonic_iface_System_IEquatable_1: never;
20
+
17
21
  readonly done: boolean;
18
22
  Done: boolean;
19
23
  readonly value: T;
@@ -34,50 +38,53 @@ export const IteratorResult_1: {
34
38
  export type IteratorResult_1<T> = IteratorResult_1$instance<T>;
35
39
 
36
40
  export interface DictionaryAdapter_1$instance<T> {
37
- Item: T | undefined;
38
- readonly Keys: IEnumerable<System_Internal.String>;
39
- readonly Values: IEnumerable<T | undefined>;
41
+ readonly __tsonic_type_Tsonic_Runtime_DictionaryAdapter_1: never;
42
+
43
+ readonly Keys: IEnumerable_1<System_Internal.String>;
44
+ readonly Values: IEnumerable_1<T | undefined>;
40
45
  ContainsKey(key: string): boolean;
41
- GetDictionary(): Dictionary<System_Internal.String, unknown | undefined>;
46
+ GetDictionary(): Dictionary_2<System_Internal.String, unknown | undefined>;
42
47
  }
43
48
 
44
49
 
45
50
  export const DictionaryAdapter_1: {
46
- new<T>(dictionary: Dictionary<System_Internal.String, unknown>): DictionaryAdapter_1<T>;
51
+ new<T>(dictionary: Dictionary_2<System_Internal.String, unknown>): DictionaryAdapter_1<T>;
47
52
  };
48
53
 
49
54
 
50
- export type DictionaryAdapter_1<T> = DictionaryAdapter_1$instance<T>;
55
+ export type DictionaryAdapter_1<T> = DictionaryAdapter_1$instance<T> & { [key: string]: T | undefined; };
51
56
 
52
57
  export interface DynamicObject$instance {
53
- get Item(): unknown | undefined;
54
- set Item(value: unknown);
58
+ readonly __tsonic_type_Tsonic_Runtime_DynamicObject: never;
59
+
55
60
  GetKeys(): string[];
56
61
  GetProperty<T>(key: string): T | undefined;
57
62
  GetValues(): (unknown | undefined)[];
58
63
  HasProperty(key: string): boolean;
59
64
  SetProperty(key: string, value: unknown): void;
60
- ToDictionary(): Dictionary<System_Internal.String, unknown | undefined>;
65
+ ToDictionary(): Dictionary_2<System_Internal.String, unknown | undefined>;
61
66
  }
62
67
 
63
68
 
64
69
  export const DynamicObject: {
65
70
  new(): DynamicObject;
66
- FromDictionary(properties: Dictionary<System_Internal.String, unknown>): DynamicObject;
71
+ FromDictionary(properties: Dictionary_2<System_Internal.String, unknown>): DynamicObject;
67
72
  };
68
73
 
69
74
 
70
- export type DynamicObject = DynamicObject$instance;
75
+ export type DynamicObject = DynamicObject$instance & { [key: string]: unknown | undefined; };
71
76
 
72
77
  export interface Union_2$instance<T1, T2> {
78
+ readonly __tsonic_type_Tsonic_Runtime_Union_2: never;
79
+
73
80
  As1(): T1;
74
81
  As2(): T2;
75
82
  Equals(obj: unknown): boolean;
76
83
  GetHashCode(): int;
77
84
  Is1(): boolean;
78
85
  Is2(): boolean;
79
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>): TResult;
80
- Match(onT1: Action<T1>, onT2: Action<T2>): void;
86
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>): TResult;
87
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>): void;
81
88
  ToString(): string | undefined;
82
89
  TryAs1(value: T1): boolean;
83
90
  TryAs2(value: T2): boolean;
@@ -85,7 +92,6 @@ export interface Union_2$instance<T1, T2> {
85
92
 
86
93
 
87
94
  export const Union_2: {
88
- new<T1, T2>(): Union_2<T1, T2>;
89
95
  From1<T1, T2>(value: T1): Union_2<T1, T2>;
90
96
  From2<T1, T2>(value: T2): Union_2<T1, T2>;
91
97
  };
@@ -94,6 +100,8 @@ export const Union_2: {
94
100
  export type Union_2<T1, T2> = Union_2$instance<T1, T2>;
95
101
 
96
102
  export interface Union_3$instance<T1, T2, T3> {
103
+ readonly __tsonic_type_Tsonic_Runtime_Union_3: never;
104
+
97
105
  As1(): T1;
98
106
  As2(): T2;
99
107
  As3(): T3;
@@ -102,8 +110,8 @@ export interface Union_3$instance<T1, T2, T3> {
102
110
  Is1(): boolean;
103
111
  Is2(): boolean;
104
112
  Is3(): boolean;
105
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>): TResult;
106
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>): void;
113
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>): TResult;
114
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>): void;
107
115
  ToString(): string | undefined;
108
116
  TryAs1(value: T1): boolean;
109
117
  TryAs2(value: T2): boolean;
@@ -112,7 +120,6 @@ export interface Union_3$instance<T1, T2, T3> {
112
120
 
113
121
 
114
122
  export const Union_3: {
115
- new<T1, T2, T3>(): Union_3<T1, T2, T3>;
116
123
  From1<T1, T2, T3>(value: T1): Union_3<T1, T2, T3>;
117
124
  From2<T1, T2, T3>(value: T2): Union_3<T1, T2, T3>;
118
125
  From3<T1, T2, T3>(value: T3): Union_3<T1, T2, T3>;
@@ -122,6 +129,8 @@ export const Union_3: {
122
129
  export type Union_3<T1, T2, T3> = Union_3$instance<T1, T2, T3>;
123
130
 
124
131
  export interface Union_4$instance<T1, T2, T3, T4> {
132
+ readonly __tsonic_type_Tsonic_Runtime_Union_4: never;
133
+
125
134
  As1(): T1;
126
135
  As2(): T2;
127
136
  As3(): T3;
@@ -132,8 +141,8 @@ export interface Union_4$instance<T1, T2, T3, T4> {
132
141
  Is2(): boolean;
133
142
  Is3(): boolean;
134
143
  Is4(): boolean;
135
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>, onT4: Func<T4, TResult>): TResult;
136
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>, onT4: Action<T4>): void;
144
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>, onT4: Func_2<T4, TResult>): TResult;
145
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>, onT4: Action_1<T4>): void;
137
146
  ToString(): string | undefined;
138
147
  TryAs1(value: T1): boolean;
139
148
  TryAs2(value: T2): boolean;
@@ -143,7 +152,6 @@ export interface Union_4$instance<T1, T2, T3, T4> {
143
152
 
144
153
 
145
154
  export const Union_4: {
146
- new<T1, T2, T3, T4>(): Union_4<T1, T2, T3, T4>;
147
155
  From1<T1, T2, T3, T4>(value: T1): Union_4<T1, T2, T3, T4>;
148
156
  From2<T1, T2, T3, T4>(value: T2): Union_4<T1, T2, T3, T4>;
149
157
  From3<T1, T2, T3, T4>(value: T3): Union_4<T1, T2, T3, T4>;
@@ -154,6 +162,8 @@ export const Union_4: {
154
162
  export type Union_4<T1, T2, T3, T4> = Union_4$instance<T1, T2, T3, T4>;
155
163
 
156
164
  export interface Union_5$instance<T1, T2, T3, T4, T5> {
165
+ readonly __tsonic_type_Tsonic_Runtime_Union_5: never;
166
+
157
167
  As1(): T1;
158
168
  As2(): T2;
159
169
  As3(): T3;
@@ -166,8 +176,8 @@ export interface Union_5$instance<T1, T2, T3, T4, T5> {
166
176
  Is3(): boolean;
167
177
  Is4(): boolean;
168
178
  Is5(): boolean;
169
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>, onT4: Func<T4, TResult>, onT5: Func<T5, TResult>): TResult;
170
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>, onT4: Action<T4>, onT5: Action<T5>): void;
179
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>, onT4: Func_2<T4, TResult>, onT5: Func_2<T5, TResult>): TResult;
180
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>, onT4: Action_1<T4>, onT5: Action_1<T5>): void;
171
181
  ToString(): string | undefined;
172
182
  TryAs1(value: T1): boolean;
173
183
  TryAs2(value: T2): boolean;
@@ -178,7 +188,6 @@ export interface Union_5$instance<T1, T2, T3, T4, T5> {
178
188
 
179
189
 
180
190
  export const Union_5: {
181
- new<T1, T2, T3, T4, T5>(): Union_5<T1, T2, T3, T4, T5>;
182
191
  From1<T1, T2, T3, T4, T5>(value: T1): Union_5<T1, T2, T3, T4, T5>;
183
192
  From2<T1, T2, T3, T4, T5>(value: T2): Union_5<T1, T2, T3, T4, T5>;
184
193
  From3<T1, T2, T3, T4, T5>(value: T3): Union_5<T1, T2, T3, T4, T5>;
@@ -190,6 +199,8 @@ export const Union_5: {
190
199
  export type Union_5<T1, T2, T3, T4, T5> = Union_5$instance<T1, T2, T3, T4, T5>;
191
200
 
192
201
  export interface Union_6$instance<T1, T2, T3, T4, T5, T6> {
202
+ readonly __tsonic_type_Tsonic_Runtime_Union_6: never;
203
+
193
204
  As1(): T1;
194
205
  As2(): T2;
195
206
  As3(): T3;
@@ -204,8 +215,8 @@ export interface Union_6$instance<T1, T2, T3, T4, T5, T6> {
204
215
  Is4(): boolean;
205
216
  Is5(): boolean;
206
217
  Is6(): boolean;
207
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>, onT4: Func<T4, TResult>, onT5: Func<T5, TResult>, onT6: Func<T6, TResult>): TResult;
208
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>, onT4: Action<T4>, onT5: Action<T5>, onT6: Action<T6>): void;
218
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>, onT4: Func_2<T4, TResult>, onT5: Func_2<T5, TResult>, onT6: Func_2<T6, TResult>): TResult;
219
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>, onT4: Action_1<T4>, onT5: Action_1<T5>, onT6: Action_1<T6>): void;
209
220
  ToString(): string | undefined;
210
221
  TryAs1(value: T1): boolean;
211
222
  TryAs2(value: T2): boolean;
@@ -217,7 +228,6 @@ export interface Union_6$instance<T1, T2, T3, T4, T5, T6> {
217
228
 
218
229
 
219
230
  export const Union_6: {
220
- new<T1, T2, T3, T4, T5, T6>(): Union_6<T1, T2, T3, T4, T5, T6>;
221
231
  From1<T1, T2, T3, T4, T5, T6>(value: T1): Union_6<T1, T2, T3, T4, T5, T6>;
222
232
  From2<T1, T2, T3, T4, T5, T6>(value: T2): Union_6<T1, T2, T3, T4, T5, T6>;
223
233
  From3<T1, T2, T3, T4, T5, T6>(value: T3): Union_6<T1, T2, T3, T4, T5, T6>;
@@ -230,6 +240,8 @@ export const Union_6: {
230
240
  export type Union_6<T1, T2, T3, T4, T5, T6> = Union_6$instance<T1, T2, T3, T4, T5, T6>;
231
241
 
232
242
  export interface Union_7$instance<T1, T2, T3, T4, T5, T6, T7> {
243
+ readonly __tsonic_type_Tsonic_Runtime_Union_7: never;
244
+
233
245
  As1(): T1;
234
246
  As2(): T2;
235
247
  As3(): T3;
@@ -246,8 +258,8 @@ export interface Union_7$instance<T1, T2, T3, T4, T5, T6, T7> {
246
258
  Is5(): boolean;
247
259
  Is6(): boolean;
248
260
  Is7(): boolean;
249
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>, onT4: Func<T4, TResult>, onT5: Func<T5, TResult>, onT6: Func<T6, TResult>, onT7: Func<T7, TResult>): TResult;
250
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>, onT4: Action<T4>, onT5: Action<T5>, onT6: Action<T6>, onT7: Action<T7>): void;
261
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>, onT4: Func_2<T4, TResult>, onT5: Func_2<T5, TResult>, onT6: Func_2<T6, TResult>, onT7: Func_2<T7, TResult>): TResult;
262
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>, onT4: Action_1<T4>, onT5: Action_1<T5>, onT6: Action_1<T6>, onT7: Action_1<T7>): void;
251
263
  ToString(): string | undefined;
252
264
  TryAs1(value: T1): boolean;
253
265
  TryAs2(value: T2): boolean;
@@ -260,7 +272,6 @@ export interface Union_7$instance<T1, T2, T3, T4, T5, T6, T7> {
260
272
 
261
273
 
262
274
  export const Union_7: {
263
- new<T1, T2, T3, T4, T5, T6, T7>(): Union_7<T1, T2, T3, T4, T5, T6, T7>;
264
275
  From1<T1, T2, T3, T4, T5, T6, T7>(value: T1): Union_7<T1, T2, T3, T4, T5, T6, T7>;
265
276
  From2<T1, T2, T3, T4, T5, T6, T7>(value: T2): Union_7<T1, T2, T3, T4, T5, T6, T7>;
266
277
  From3<T1, T2, T3, T4, T5, T6, T7>(value: T3): Union_7<T1, T2, T3, T4, T5, T6, T7>;
@@ -274,6 +285,8 @@ export const Union_7: {
274
285
  export type Union_7<T1, T2, T3, T4, T5, T6, T7> = Union_7$instance<T1, T2, T3, T4, T5, T6, T7>;
275
286
 
276
287
  export interface Union_8$instance<T1, T2, T3, T4, T5, T6, T7, T8> {
288
+ readonly __tsonic_type_Tsonic_Runtime_Union_8: never;
289
+
277
290
  As1(): T1;
278
291
  As2(): T2;
279
292
  As3(): T3;
@@ -292,8 +305,8 @@ export interface Union_8$instance<T1, T2, T3, T4, T5, T6, T7, T8> {
292
305
  Is6(): boolean;
293
306
  Is7(): boolean;
294
307
  Is8(): boolean;
295
- Match<TResult>(onT1: Func<T1, TResult>, onT2: Func<T2, TResult>, onT3: Func<T3, TResult>, onT4: Func<T4, TResult>, onT5: Func<T5, TResult>, onT6: Func<T6, TResult>, onT7: Func<T7, TResult>, onT8: Func<T8, TResult>): TResult;
296
- Match(onT1: Action<T1>, onT2: Action<T2>, onT3: Action<T3>, onT4: Action<T4>, onT5: Action<T5>, onT6: Action<T6>, onT7: Action<T7>, onT8: Action<T8>): void;
308
+ Match<TResult>(onT1: Func_2<T1, TResult>, onT2: Func_2<T2, TResult>, onT3: Func_2<T3, TResult>, onT4: Func_2<T4, TResult>, onT5: Func_2<T5, TResult>, onT6: Func_2<T6, TResult>, onT7: Func_2<T7, TResult>, onT8: Func_2<T8, TResult>): TResult;
309
+ Match(onT1: Action_1<T1>, onT2: Action_1<T2>, onT3: Action_1<T3>, onT4: Action_1<T4>, onT5: Action_1<T5>, onT6: Action_1<T6>, onT7: Action_1<T7>, onT8: Action_1<T8>): void;
297
310
  ToString(): string | undefined;
298
311
  TryAs1(value: T1): boolean;
299
312
  TryAs2(value: T2): boolean;
@@ -307,7 +320,6 @@ export interface Union_8$instance<T1, T2, T3, T4, T5, T6, T7, T8> {
307
320
 
308
321
 
309
322
  export const Union_8: {
310
- new<T1, T2, T3, T4, T5, T6, T7, T8>(): Union_8<T1, T2, T3, T4, T5, T6, T7, T8>;
311
323
  From1<T1, T2, T3, T4, T5, T6, T7, T8>(value: T1): Union_8<T1, T2, T3, T4, T5, T6, T7, T8>;
312
324
  From2<T1, T2, T3, T4, T5, T6, T7, T8>(value: T2): Union_8<T1, T2, T3, T4, T5, T6, T7, T8>;
313
325
  From3<T1, T2, T3, T4, T5, T6, T7, T8>(value: T3): Union_8<T1, T2, T3, T4, T5, T6, T7, T8>;
@@ -322,8 +334,8 @@ export const Union_8: {
322
334
  export type Union_8<T1, T2, T3, T4, T5, T6, T7, T8> = Union_8$instance<T1, T2, T3, T4, T5, T6, T7, T8>;
323
335
 
324
336
  export abstract class ArrayHelpers$instance {
325
- static Slice<T>(source: IEnumerable<T>, startIndex: int): T[];
326
- static Slice<T>(source: IList<T>, startIndex: int): T[];
337
+ static Slice<T>(source: IEnumerable_1<T>, startIndex: int): T[];
338
+ static Slice<T>(source: IList_1<T>, startIndex: int): T[];
327
339
  static Slice<T>(source: T[], startIndex: int): T[];
328
340
  }
329
341
 
@@ -340,9 +352,9 @@ export type Operators = Operators$instance;
340
352
 
341
353
  export abstract class Structural$instance {
342
354
  static Clone<T>(source: unknown): T | undefined;
343
- static CloneFromDictionary<T>(source: Dictionary<System_Internal.String, unknown>): T | undefined;
344
- static CreateDictionaryAdapter<T>(source: Dictionary<System_Internal.String, unknown>): DictionaryAdapter_1<T>;
345
- static ToDictionary(source: unknown): Dictionary<System_Internal.String, unknown | undefined>;
355
+ static CloneFromDictionary<T>(source: Dictionary_2<System_Internal.String, unknown>): T | undefined;
356
+ static CreateDictionaryAdapter<T>(source: Dictionary_2<System_Internal.String, unknown>): DictionaryAdapter_1<T>;
357
+ static ToDictionary(source: unknown): Dictionary_2<System_Internal.String, unknown | undefined>;
346
358
  }
347
359
 
348
360
 
package/attributes.d.ts DELETED
@@ -1,192 +0,0 @@
1
- // @tsonic/core/attributes.d.ts
2
-
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
-
5
- /**
6
- * Compiler-only attribute API for Tsonic.
7
- *
8
- * Design goals:
9
- * - Clean, consistent, "compiler-grade" surface area.
10
- * - Fully type-safe selection of targets (type / ctor / method / property).
11
- * - Attributes are represented as:
12
- * - A constructor reference (e.g., ObsoleteAttribute)
13
- * - Optional ctor args (typed via ConstructorParameters)
14
- * - Optional helper `A.attr(...)` to build an attribute descriptor (also typed).
15
- *
16
- * Runtime note:
17
- * This module is expected to be erased/ignored by the compiler pipeline.
18
- */
19
-
20
- /** A class constructor type. */
21
- export type Ctor<T = unknown, Args extends readonly any[] = readonly any[]> = new (
22
- ...args: Args
23
- ) => T;
24
-
25
- /** Any attribute class constructor. */
26
- export type AttributeCtor = Ctor<object, readonly any[]>;
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
-
63
- /** Attribute application (constructor + ctor arguments). */
64
- export interface AttributeDescriptor<C extends AttributeCtor = AttributeCtor> {
65
- readonly kind: "attribute";
66
- readonly ctor: C;
67
- readonly args: readonly OverloadedConstructorParameters<C>;
68
- }
69
-
70
- /** Extract instance type of a constructor. */
71
- export type InstanceOf<C extends Ctor<any, any>> = C extends Ctor<infer I, any>
72
- ? I
73
- : never;
74
-
75
- /** Keys of T whose values are callable. */
76
- export type MethodKeys<T> = {
77
- [K in keyof T]-?: T[K] extends (...args: any[]) => any ? K : never;
78
- }[keyof T];
79
-
80
- /** Keys of T whose values are NOT callable (i.e., "properties"). */
81
- export type PropertyKeys<T> = {
82
- [K in keyof T]-?: T[K] extends (...args: any[]) => any ? never : K;
83
- }[keyof T];
84
-
85
- /**
86
- * Inferred "method value type" from a method selector.
87
- * The selector must resolve to a function-valued member on T.
88
- */
89
- export type SelectedMethodValue<T> = (...args: any[]) => any;
90
-
91
- /**
92
- * Fluent builder returned from A.on(Foo).
93
- * Allows attaching attributes to:
94
- * - the type itself
95
- * - the constructor
96
- * - a method
97
- * - a property
98
- */
99
- export interface OnBuilder<T> {
100
- /** Attach attributes to the type declaration (C# class/interface). */
101
- type: AttributeTargetBuilder;
102
-
103
- /** Attach attributes to the constructor. */
104
- ctor: AttributeTargetBuilder;
105
-
106
- /**
107
- * Select a method to annotate.
108
- *
109
- * The selector must be a simple member access in practice (enforced by compiler),
110
- * but is typed here as: (t: T) => T[K] where K is a method key.
111
- *
112
- * Example:
113
- * A.on(User).method(u => u.save).add(TransactionAttribute);
114
- */
115
- method<K extends MethodKeys<T>>(
116
- selector: (t: T) => T[K]
117
- ): AttributeTargetBuilder;
118
-
119
- /**
120
- * Select a property to annotate.
121
- *
122
- * Example:
123
- * A.on(User).prop(u => u.name).add(JsonPropertyNameAttribute, "name");
124
- */
125
- prop<K extends PropertyKeys<T>>(
126
- selector: (t: T) => T[K]
127
- ): AttributeTargetBuilder;
128
- }
129
-
130
- /**
131
- * Target builder that supports adding attributes.
132
- * Supports two canonical forms:
133
- * - add(AttrCtor, ...args)
134
- * - add(A.attr(AttrCtor, ...args))
135
- */
136
- export interface AttributeTargetBuilder {
137
- /**
138
- * Add an attribute by constructor + arguments.
139
- *
140
- * Example:
141
- * A.on(Config).type.add(ObsoleteAttribute, "Will be removed in v2");
142
- */
143
- add<C extends AttributeCtor>(
144
- ctor: C,
145
- ...args: OverloadedConstructorParameters<C>
146
- ): void;
147
-
148
- /**
149
- * Add an attribute descriptor produced by A.attr(...).
150
- *
151
- * Example:
152
- * A.on(Config).type.add(A.attr(ObsoleteAttribute, "Will be removed in v2"));
153
- */
154
- add<C extends AttributeCtor>(descriptor: AttributeDescriptor<C>): void;
155
- }
156
-
157
- /**
158
- * The main entrypoint.
159
- *
160
- * Usage:
161
- * import { attributes as A } from "@tsonic/core/attributes.js";
162
- *
163
- * class Config {}
164
- * A.on(Config).type.add(SerializableAttribute);
165
- * A.on(Config).type.add(ObsoleteAttribute, "Will be removed in v2");
166
- *
167
- * Emits:
168
- * [System.SerializableAttribute]
169
- * [System.ObsoleteAttribute("Will be removed in v2")]
170
- */
171
- export interface AttributesApi {
172
- /**
173
- * Begin targeting a type by passing its constructor.
174
- */
175
- on<C extends Ctor<any, any>>(ctor: C): OnBuilder<InstanceOf<C>>;
176
-
177
- /**
178
- * Build an attribute descriptor (compiler-known "attribute instance").
179
- *
180
- * Example:
181
- * A.on(Config).type.add(A.attr(ObsoleteAttribute, "Will be removed in v2"));
182
- */
183
- attr<C extends AttributeCtor>(
184
- ctor: C,
185
- ...args: OverloadedConstructorParameters<C>
186
- ): AttributeDescriptor<C>;
187
- }
188
-
189
- /**
190
- * Named export used by consumers.
191
- */
192
- export declare const attributes: AttributesApi;