typescript 5.1.6 → 5.2.2

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.
@@ -35,6 +35,11 @@ type DecoratorContext =
35
35
  | ClassMemberDecoratorContext
36
36
  ;
37
37
 
38
+ type DecoratorMetadataObject = Record<PropertyKey, unknown> & object;
39
+
40
+ type DecoratorMetadata =
41
+ typeof globalThis extends { Symbol: { readonly metadata: symbol } } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;
42
+
38
43
  /**
39
44
  * Context provided to a class decorator.
40
45
  * @template Class The type of the decorated class associated with this context.
@@ -66,6 +71,8 @@ interface ClassDecoratorContext<
66
71
  * ```
67
72
  */
68
73
  addInitializer(initializer: (this: Class) => void): void;
74
+
75
+ readonly metadata: DecoratorMetadata;
69
76
  }
70
77
 
71
78
  /**
@@ -130,6 +137,8 @@ interface ClassMethodDecoratorContext<
130
137
  * ```
131
138
  */
132
139
  addInitializer(initializer: (this: This) => void): void;
140
+
141
+ readonly metadata: DecoratorMetadata;
133
142
  }
134
143
 
135
144
  /**
@@ -175,6 +184,8 @@ interface ClassGetterDecoratorContext<
175
184
  * decorating a non-`static` element).
176
185
  */
177
186
  addInitializer(initializer: (this: This) => void): void;
187
+
188
+ readonly metadata: DecoratorMetadata;
178
189
  }
179
190
 
180
191
  /**
@@ -220,6 +231,8 @@ interface ClassSetterDecoratorContext<
220
231
  * decorating a non-`static` element).
221
232
  */
222
233
  addInitializer(initializer: (this: This) => void): void;
234
+
235
+ readonly metadata: DecoratorMetadata;
223
236
  }
224
237
 
225
238
  /**
@@ -274,6 +287,8 @@ interface ClassAccessorDecoratorContext<
274
287
  * decorating a non-`static` element).
275
288
  */
276
289
  addInitializer(initializer: (this: This) => void): void;
290
+
291
+ readonly metadata: DecoratorMetadata;
277
292
  }
278
293
 
279
294
  /**
@@ -369,4 +384,6 @@ interface ClassFieldDecoratorContext<
369
384
  * decorating a non-`static` element).
370
385
  */
371
386
  addInitializer(initializer: (this: This) => void): void;
387
+
388
+ readonly metadata: DecoratorMetadata;
372
389
  }