@typescript-deploys/pr-build 5.0.0-pr-50820-27 → 5.0.0-pr-50820-31

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.
@@ -39,6 +39,7 @@ type DecoratorContext =
39
39
 
40
40
  /**
41
41
  * Context provided to a class decorator.
42
+ * @template Class The type of the decorated class associated with this context.
42
43
  */
43
44
  interface ClassDecoratorContext<
44
45
  Class extends abstract new (...args: any) => any = abstract new (...args: any) => any
@@ -70,20 +71,56 @@ interface ClassDecoratorContext<
70
71
  }
71
72
 
72
73
  /**
73
- * Describes the call signature of a generic function that can be used to decorate a class.
74
- * @param target The decorated class constructor.
75
- * @param context Additional context about the decorated class.
76
- * @returns A replacement class constructor, or `undefined`.
74
+ * Describes a function that can be used to decorate a class.
75
+ * @template Overrides Constrains the context to specific values for `name`.
76
+ * @template Class The constructor type of the class.
77
77
  */
78
- type ClassDecoratorFunction<Overrides extends { name?: string | undefined } = {}> = <
79
- Class extends abstract new (...args: any) => any,
80
- >(
81
- target: Class,
82
- context: ClassDecoratorContext<Class> & Overrides
83
- ) => Class | void;
78
+ type ClassDecoratorFunction<
79
+ Overrides extends { name?: string | undefined } = {},
80
+ Class extends abstract new (...args: any) => any = abstract new (...args: any) => any
81
+ > =
82
+ /**
83
+ * Describes a function that can be used to decorate a class.
84
+ * @param target The decorated class constructor.
85
+ * @param context Additional context about the decorated class.
86
+ * @returns A replacement class constructor, or `undefined`.
87
+ */
88
+ (
89
+ target: Class,
90
+ context: ClassDecoratorContext<Class> & Overrides
91
+ ) => Class | void;
92
+
93
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
94
+ // /**
95
+ // * Describes a function that can be used to decorate a class.
96
+ // * @template Overrides Constrains the context to specific values for `name`.
97
+ // * @template In The input constructor type of the class.
98
+ // * @template Out The output constructor type of the class.
99
+ // * @template Final The final constructor type of the class.
100
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
101
+ // */
102
+ // type ClassDecoratorFunction<
103
+ // Overrides extends { name?: string | undefined } = {},
104
+ // In extends abstract new (...args: any) => any = abstract new (...args: any) => any,
105
+ // Out extends In = In,
106
+ // Final extends Out = Out,
107
+ // > =
108
+ // /**
109
+ // * Describes a function that can be used to decorate a class.
110
+ // * @param target The decorated class constructor.
111
+ // * @param context Additional context about the decorated class.
112
+ // * @returns A replacement class constructor, or `undefined`.
113
+ // */
114
+ // (
115
+ // target: In,
116
+ // context: ClassDecoratorContext<Final> & Overrides
117
+ // ) => Out | void;
84
118
 
85
119
  /**
86
120
  * Context provided to a class method decorator.
121
+ * @template This The type on which the class element will be defined. For a static class element, this will be
122
+ * the type of the constructor. For a non-static class element, this will be the type of the instance.
123
+ * @template Value The type of the decorated class method.
87
124
  */
88
125
  interface ClassMethodDecoratorContext<
89
126
  This = unknown,
@@ -140,18 +177,60 @@ interface ClassMethodDecoratorContext<
140
177
  }
141
178
 
142
179
  /**
143
- * Describes a generic function that can be used to decorate a class method.
144
- * @param target The function for the decorated class method.
145
- * @param context Additional context about the decorated class method.
146
- * @returns A replacement function, or `undefined`.
180
+ * Describes a function that can be used to decorate a class method.
181
+ * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
182
+ * @template This The `this` type of the decorated class element.
183
+ * @template Value The function type of the class method.
147
184
  */
148
- type ClassMethodDecoratorFunction<Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}> = <
149
- This,
150
- Value extends (this: This, ...args: any) => any
151
- >(target: Value, context: ClassMethodDecoratorContext<This, Value> & Overrides) => Value | void;
185
+ type ClassMethodDecoratorFunction<
186
+ Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
187
+ This = unknown,
188
+ Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any
189
+ > =
190
+ /**
191
+ * Describes a function that can be used to decorate a class method.
192
+ * @param target The function for the decorated class method.
193
+ * @param context Additional context about the decorated class method.
194
+ * @returns A replacement function, or `undefined`.
195
+ */
196
+ (
197
+ target: Value,
198
+ context: ClassMethodDecoratorContext<This, Value> & Overrides
199
+ ) => Value | void;
200
+
201
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
202
+ // /**
203
+ // * Describes a function that can be used to decorate a class method.
204
+ // * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
205
+ // * @template This The final `this` type of the decorated class element.
206
+ // * @template In The input function type of the class method.
207
+ // * @template Out The output function type of the class method.
208
+ // * @template Final The final function type of the class method.
209
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
210
+ // */
211
+ // type ClassMethodDecoratorFunction<
212
+ // Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
213
+ // This = unknown,
214
+ // In extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
215
+ // Out extends In = In,
216
+ // Final extends Out = Out,
217
+ // > =
218
+ // /**
219
+ // * Describes a function that can be used to decorate a class method.
220
+ // * @param target The function for the decorated class method.
221
+ // * @param context Additional context about the decorated class method.
222
+ // * @returns A replacement function, or `undefined`.
223
+ // */
224
+ // (
225
+ // target: In,
226
+ // context: ClassMethodDecoratorContext<This, Final> & Overrides
227
+ // ) => Out | void;
152
228
 
153
229
  /**
154
- * Context provided to a class `get` method decorator.
230
+ * Context provided to a class getter decorator.
231
+ * @template This The type on which the class element will be defined. For a static class element, this will be
232
+ * the type of the constructor. For a non-static class element, this will be the type of the instance.
233
+ * @template Value The property type of the decorated class getter.
155
234
  */
156
235
  interface ClassGetterDecoratorContext<
157
236
  This = unknown,
@@ -189,21 +268,60 @@ interface ClassGetterDecoratorContext<
189
268
  }
190
269
 
191
270
  /**
192
- * Describes a generic function that can be used to decorate a class `get` method.
193
- * @param target The getter function for the decorated class `get` method.
194
- * @param context Additional context about the decorated class `get` method.
195
- * @returns A replacement getter function, or `undefined`.
271
+ * Describes a function that can be used to decorate a class getter.
272
+ * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
273
+ * @template This The `this` type of the decorated class element.
274
+ * @template Value The property type of the class getter.
196
275
  */
197
- type ClassGetterDecoratorFunction<Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}> = <
198
- This,
199
- Value,
200
- >(
201
- target: (this: This) => Value,
202
- context: ClassGetterDecoratorContext<This, Value> & Overrides
203
- ) => ((this: This) => Value) | void;
276
+ type ClassGetterDecoratorFunction<
277
+ Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
278
+ This = unknown,
279
+ Value = unknown,
280
+ > =
281
+ /**
282
+ * Describes a function that can be used to decorate a class getter.
283
+ * @param target The getter function for the decorated class getter.
284
+ * @param context Additional context about the decorated class getter.
285
+ * @returns A replacement getter function, or `undefined`.
286
+ */
287
+ (
288
+ target: (this: This) => Value,
289
+ context: ClassGetterDecoratorContext<This, Value> & Overrides
290
+ ) => ((this: This) => Value) | void;
291
+
292
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
293
+ // /**
294
+ // * Describes a function that can be used to decorate a class getter.
295
+ // * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
296
+ // * @template This The final `this` type of the decorated class element.
297
+ // * @template In The input property type of the class getter.
298
+ // * @template Out The output property type of the class getter.
299
+ // * @template Final The final property type of the class getter.
300
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
301
+ // */
302
+ // type ClassGetterDecoratorFunction<
303
+ // Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
304
+ // This = unknown,
305
+ // In = unknown,
306
+ // Out extends In = In,
307
+ // Final extends Out = Out,
308
+ // > =
309
+ // /**
310
+ // * Describes a function that can be used to decorate a class getter.
311
+ // * @param target The getter function for the decorated class getter.
312
+ // * @param context Additional context about the decorated class getter.
313
+ // * @returns A replacement getter function, or `undefined`.
314
+ // */
315
+ // (
316
+ // target: (this: This) => In,
317
+ // context: ClassGetterDecoratorContext<This, Final> & Overrides
318
+ // ) => ((this: This) => Out) | void;
204
319
 
205
320
  /**
206
- * Context provided to a class `set` method decorator.
321
+ * Context provided to a class setter decorator.
322
+ * @template This The type on which the class element will be defined. For a static class element, this will be
323
+ * the type of the constructor. For a non-static class element, this will be the type of the instance.
324
+ * @template Value The type of the decorated class setter.
207
325
  */
208
326
  interface ClassSetterDecoratorContext<
209
327
  This = unknown,
@@ -241,21 +359,61 @@ interface ClassSetterDecoratorContext<
241
359
  }
242
360
 
243
361
  /**
244
- * Describes a generic function that can be used to decorate a class `set` method.
245
- * @param target The setter function for the decorated class `set` method.
246
- * @param context Additional context about the decorated class `set` method.
247
- * @returns A replacement setter function, or `undefined`.
362
+ * Describes a function that can be used to decorate a class setter.
363
+ * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
364
+ * @template This The `this` type of the decorated class element.
365
+ * @template Value The property type of the class setter.
366
+ * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
248
367
  */
249
- type ClassSetterDecoratorFunction<Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}> = <
250
- This,
251
- Value,
252
- >(
253
- target: (this: This, value: Value) => void,
254
- context: ClassSetterDecoratorContext<This, Value> & Overrides
255
- ) => ((this: This, value: Value) => void) | void;
368
+ type ClassSetterDecoratorFunction<
369
+ Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
370
+ This = unknown,
371
+ Value = unknown,
372
+ > =
373
+ /**
374
+ * Describes a function that can be used to decorate a class setter.
375
+ * @param target The setter function for the decorated class setter.
376
+ * @param context Additional context about the decorated class setter.
377
+ * @returns A replacement setter function, or `undefined`.
378
+ */
379
+ (
380
+ target: (this: This, value: Value) => void,
381
+ context: ClassSetterDecoratorContext<This, Value> & Overrides
382
+ ) => ((this: This, value: Value) => void) | void;
383
+
384
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
385
+ // /**
386
+ // * Describes a function that can be used to decorate a class setter.
387
+ // * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
388
+ // * @template This The final `this` type of the decorated class element.
389
+ // * @template In The input property type of the class setter.
390
+ // * @template Out The output property type of the class setter.
391
+ // * @template Final The final property type of the class setter.
392
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
393
+ // */
394
+ // type ClassSetterDecoratorFunction<
395
+ // Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
396
+ // This = unknown,
397
+ // In = unknown,
398
+ // Out extends In = In,
399
+ // Final extends Out = Out,
400
+ // > =
401
+ // /**
402
+ // * Describes a function that can be used to decorate a class setter.
403
+ // * @param target The setter function for the decorated class setter.
404
+ // * @param context Additional context about the decorated class setter.
405
+ // * @returns A replacement setter function, or `undefined`.
406
+ // */
407
+ // (
408
+ // target: (this: This, value: In) => void,
409
+ // context: ClassSetterDecoratorContext<This, Final> & Overrides
410
+ // ) => ((this: This, value: Out) => void) | void;
256
411
 
257
412
  /**
258
413
  * Context provided to a class `accessor` field decorator.
414
+ * @template This The type on which the class element will be defined. For a static class element, this will be
415
+ * the type of the constructor. For a non-static class element, this will be the type of the instance.
416
+ * @template Value The type of decorated class field.
259
417
  */
260
418
  interface ClassAccessorDecoratorContext<
261
419
  This = unknown,
@@ -302,6 +460,8 @@ interface ClassAccessorDecoratorContext<
302
460
 
303
461
  /**
304
462
  * Describes the target provided to class `accessor` field decorators.
463
+ * @template This The `this` type to which the target applies.
464
+ * @template Value The property type for the class `accessor` field.
305
465
  */
306
466
  interface ClassAccessorDecoratorTarget<This, Value> {
307
467
  /**
@@ -323,6 +483,8 @@ interface ClassAccessorDecoratorTarget<This, Value> {
323
483
 
324
484
  /**
325
485
  * Describes the allowed return value from a class `accessor` field decorator.
486
+ * @template This The `this` type to which the target applies.
487
+ * @template Value The property type for the class `accessor` field.
326
488
  */
327
489
  interface ClassAccessorDecoratorResult<This, Value> {
328
490
  /**
@@ -344,21 +506,61 @@ interface ClassAccessorDecoratorResult<This, Value> {
344
506
  }
345
507
 
346
508
  /**
347
- * Describes a generic function that can be used to decorate a class `accessor` field.
348
- * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field.
349
- * @param context Additional context about the decorated class `accessor` field.
350
- * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter.
509
+ * Describes a function that can be used to decorate a class `accessor` field.
510
+ * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
511
+ * @template This The `this` type of the decorated class element.
512
+ * @template Value The property type of the class `accessor` field.
513
+ * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
351
514
  */
352
- type ClassAccessorDecoratorFunction<Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}> = <
353
- This,
354
- Value,
355
- >(
356
- target: ClassAccessorDecoratorTarget<This, Value>,
357
- context: ClassAccessorDecoratorContext<This, Value> & Overrides
358
- ) => ClassAccessorDecoratorResult<This, Value> | void;
515
+ type ClassAccessorDecoratorFunction<
516
+ Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
517
+ This = unknown,
518
+ Value = unknown,
519
+ > =
520
+ /**
521
+ * Describes a function that can be used to decorate a class `accessor` field.
522
+ * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field.
523
+ * @param context Additional context about the decorated class `accessor` field.
524
+ * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter.
525
+ */
526
+ (
527
+ target: ClassAccessorDecoratorTarget<This, Value>,
528
+ context: ClassAccessorDecoratorContext<This, Value> & Overrides
529
+ ) => ClassAccessorDecoratorResult<This, Value> | void;
530
+
531
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
532
+ // /**
533
+ // * Describes a function that can be used to decorate a class `accessor` field.
534
+ // * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
535
+ // * @template This The final `this` type of the decorated class element.
536
+ // * @template In The input property type of the class `accessor` field.
537
+ // * @template Out The output property type of the class `accessor` field.
538
+ // * @template Final The final property type of the class `accessor` field.
539
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
540
+ // */
541
+ // type ClassAccessorDecoratorFunction<
542
+ // Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
543
+ // This = unknown,
544
+ // In = unknown,
545
+ // Out extends In = In,
546
+ // Final extends Out = Out,
547
+ // > =
548
+ // /**
549
+ // * Describes a function that can be used to decorate a class `accessor` field.
550
+ // * @param target The {@link ClassAccessorDecoratorTarget} the decorated class `accessor` field.
551
+ // * @param context Additional context about the decorated class `accessor` field.
552
+ // * @returns A {@link ClassAccessorDecoratorResult} that is used to replace the getter or setter or to inject an initializer mutator, or `undefined` to use the existing getter and setter.
553
+ // */
554
+ // (
555
+ // target: ClassAccessorDecoratorTarget<This, In>,
556
+ // context: ClassAccessorDecoratorContext<This, Final> & Overrides
557
+ // ) => ClassAccessorDecoratorResult<This, Out> | void;
359
558
 
360
559
  /**
361
560
  * Context provided to a class field decorator.
561
+ * @template This The type on which the class element will be defined. For a static class element, this will be
562
+ * the type of the constructor. For a non-static class element, this will be the type of the instance.
563
+ * @template Value The type of the decorated class field.
362
564
  */
363
565
  interface ClassFieldDecoratorContext<
364
566
  This = unknown,
@@ -398,15 +600,52 @@ interface ClassFieldDecoratorContext<
398
600
  }
399
601
 
400
602
  /**
401
- * Describes a generic function that can be used to decorate a class field.
402
- * @param target Class field decorators always receive `undefined`.
403
- * @param context Additional context about the decorated class field.
404
- * @returns An initializer mutator function, or `undefined`.
603
+ * Describes a function that can be used to decorate a class field.
604
+ * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
605
+ * @template This The `this` type of the decorated class element.
606
+ * @template Value The property type of the class field.
607
+ * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
405
608
  */
406
- type ClassFieldDecoratorFunction<Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {}> = <
407
- This,
408
- Value,
409
- >(
410
- target: undefined,
411
- context: ClassFieldDecoratorContext<This, Value> & Overrides
412
- ) => ((this: This, initialValue: Value) => Value) | void;
609
+ type ClassFieldDecoratorFunction<
610
+ Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
611
+ This = unknown,
612
+ Value = unknown,
613
+ > =
614
+ /**
615
+ * Describes a function that can be used to decorate a class field.
616
+ * @param target Class field decorators always receive `undefined`.
617
+ * @param context Additional context about the decorated class field.
618
+ * @returns An initializer mutator function, or `undefined`.
619
+ */
620
+ (
621
+ target: undefined,
622
+ context: ClassFieldDecoratorContext<This, Value> & Overrides
623
+ ) => ((this: This, initialValue: Value) => Value) | void;
624
+
625
+ // NOTE: If decorators eventually support type mutation, we will use this definition instead:
626
+ // /**
627
+ // * Describes a function that can be used to decorate a class field.
628
+ // * @template Overrides Constrains the context to specific values for `name`, `private`, and `static`.
629
+ // * @template This The final `this` type of the decorated class element.
630
+ // * @template In The input property type of the class field.
631
+ // * @template Out The output property type of the class field.
632
+ // * @template Final The final property type of the class field.
633
+ // * @remarks Decorators do not currently support type mutation, so `In`, `Out`, and `Final` should be the same type.
634
+ // */
635
+ // type ClassFieldDecoratorFunction<
636
+ // Overrides extends { name?: string | symbol, private?: boolean, static?: boolean } = {},
637
+ // This = unknown,
638
+ // In = unknown,
639
+ // Out extends In = In,
640
+ // Final extends Out = Out,
641
+ // > =
642
+ // /**
643
+ // * Describes a function that can be used to decorate a class field.
644
+ // * @param target Class field decorators always receive `undefined`.
645
+ // * @param context Additional context about the decorated class field.
646
+ // * @returns An initializer mutator function, or `undefined`.
647
+ // */
648
+ // (
649
+ // target: undefined,
650
+ // context: ClassFieldDecoratorContext<This, Final> & Overrides
651
+ // ) => ((this: This, initialValue: In) => Out) | void;