typescript 5.0.0-dev.20230208 → 5.0.0-dev.20230210

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.
@@ -17,7 +17,7 @@ and limitations under the License.
17
17
  /// <reference no-default-lib="true"/>
18
18
 
19
19
  /**
20
- * The decorator context types provided to class member decorators.
20
+ * The decorator context types provided to class element decorators.
21
21
  */
22
22
  type ClassMemberDecoratorContext =
23
23
  | ClassMethodDecoratorContext
@@ -78,34 +78,37 @@ interface ClassMethodDecoratorContext<
78
78
  This = unknown,
79
79
  Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
80
80
  > {
81
- /** The kind of class member that was decorated. */
81
+ /** The kind of class element that was decorated. */
82
82
  readonly kind: "method";
83
83
 
84
- /** The name of the decorated class member. */
84
+ /** The name of the decorated class element. */
85
85
  readonly name: string | symbol;
86
86
 
87
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
87
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
88
88
  readonly static: boolean;
89
89
 
90
- /** A value indicating whether the class member has a private name. */
90
+ /** A value indicating whether the class element has a private name. */
91
91
  readonly private: boolean;
92
92
 
93
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
94
- // /** An object that can be used to access the current value of the class member at runtime. */
95
- // readonly access: {
96
- // /**
97
- // * Gets the current value of the method from the provided receiver.
98
- // *
99
- // * @example
100
- // * let fn = context.access.get.call(instance);
101
- // */
102
- // get(this: This): Value;
103
- // };
93
+ /** An object that can be used to access the current value of the class element at runtime. */
94
+ readonly access: {
95
+ /**
96
+ * Determines whether an object has a property with the same name as the decorated element.
97
+ */
98
+ has(object: This): boolean;
99
+ /**
100
+ * Gets the current value of the method from the provided object.
101
+ *
102
+ * @example
103
+ * let fn = context.access.get(instance);
104
+ */
105
+ get(object: This): Value;
106
+ };
104
107
 
105
108
  /**
106
109
  * Adds a callback to be invoked either before static initializers are run (when
107
- * decorating a `static` member), or before instance initializers are run (when
108
- * decorating a non-`static` member).
110
+ * decorating a `static` element), or before instance initializers are run (when
111
+ * decorating a non-`static` element).
109
112
  *
110
113
  * @example
111
114
  * ```ts
@@ -139,34 +142,37 @@ interface ClassGetterDecoratorContext<
139
142
  This = unknown,
140
143
  Value = unknown,
141
144
  > {
142
- /** The kind of class member that was decorated. */
145
+ /** The kind of class element that was decorated. */
143
146
  readonly kind: "getter";
144
147
 
145
- /** The name of the decorated class member. */
148
+ /** The name of the decorated class element. */
146
149
  readonly name: string | symbol;
147
150
 
148
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
151
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
149
152
  readonly static: boolean;
150
153
 
151
- /** A value indicating whether the class member has a private name. */
154
+ /** A value indicating whether the class element has a private name. */
152
155
  readonly private: boolean;
153
156
 
154
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
155
- // /** An object that can be used to access the current value of the class member at runtime. */
156
- // readonly access: {
157
- // /**
158
- // * Invokes the getter on the provided receiver.
159
- // *
160
- // * @example
161
- // * let value = context.access.get.call(instance);
162
- // */
163
- // get(this: This): Value;
164
- // };
157
+ /** An object that can be used to access the current value of the class element at runtime. */
158
+ readonly access: {
159
+ /**
160
+ * Determines whether an object has a property with the same name as the decorated element.
161
+ */
162
+ has(object: This): boolean;
163
+ /**
164
+ * Invokes the getter on the provided object.
165
+ *
166
+ * @example
167
+ * let value = context.access.get(instance);
168
+ */
169
+ get(object: This): Value;
170
+ };
165
171
 
166
172
  /**
167
173
  * Adds a callback to be invoked either before static initializers are run (when
168
- * decorating a `static` member), or before instance initializers are run (when
169
- * decorating a non-`static` member).
174
+ * decorating a `static` element), or before instance initializers are run (when
175
+ * decorating a non-`static` element).
170
176
  */
171
177
  addInitializer(initializer: (this: This) => void): void;
172
178
  }
@@ -181,34 +187,37 @@ interface ClassSetterDecoratorContext<
181
187
  This = unknown,
182
188
  Value = unknown,
183
189
  > {
184
- /** The kind of class member that was decorated. */
190
+ /** The kind of class element that was decorated. */
185
191
  readonly kind: "setter";
186
192
 
187
- /** The name of the decorated class member. */
193
+ /** The name of the decorated class element. */
188
194
  readonly name: string | symbol;
189
195
 
190
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
196
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
191
197
  readonly static: boolean;
192
198
 
193
- /** A value indicating whether the class member has a private name. */
199
+ /** A value indicating whether the class element has a private name. */
194
200
  readonly private: boolean;
195
201
 
196
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
197
- /** An object that can be used to access the current value of the class member at runtime. */
198
- // readonly access: {
199
- // /**
200
- // * Invokes the setter on the provided receiver.
201
- // *
202
- // * @example
203
- // * context.access.set.call(instance, value);
204
- // */
205
- // set(this: This, value: Value): void;
206
- // };
202
+ /** An object that can be used to access the current value of the class element at runtime. */
203
+ readonly access: {
204
+ /**
205
+ * Determines whether an object has a property with the same name as the decorated element.
206
+ */
207
+ has(object: This): boolean;
208
+ /**
209
+ * Invokes the setter on the provided object.
210
+ *
211
+ * @example
212
+ * context.access.set(instance, value);
213
+ */
214
+ set(object: This, value: Value): void;
215
+ };
207
216
 
208
217
  /**
209
218
  * Adds a callback to be invoked either before static initializers are run (when
210
- * decorating a `static` member), or before instance initializers are run (when
211
- * decorating a non-`static` member).
219
+ * decorating a `static` element), or before instance initializers are run (when
220
+ * decorating a non-`static` element).
212
221
  */
213
222
  addInitializer(initializer: (this: This) => void): void;
214
223
  }
@@ -223,42 +232,46 @@ interface ClassAccessorDecoratorContext<
223
232
  This = unknown,
224
233
  Value = unknown,
225
234
  > {
226
- /** The kind of class member that was decorated. */
235
+ /** The kind of class element that was decorated. */
227
236
  readonly kind: "accessor";
228
237
 
229
- /** The name of the decorated class member. */
238
+ /** The name of the decorated class element. */
230
239
  readonly name: string | symbol;
231
240
 
232
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
241
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
233
242
  readonly static: boolean;
234
243
 
235
- /** A value indicating whether the class member has a private name. */
244
+ /** A value indicating whether the class element has a private name. */
236
245
  readonly private: boolean;
237
246
 
238
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
239
- // /** An object that can be used to access the current value of the class member at runtime. */
240
- // readonly access: {
241
- // /**
242
- // * Invokes the getter on the provided receiver.
243
- // *
244
- // * @example
245
- // * let value = context.access.get.call(instance);
246
- // */
247
- // get(this: This): Value;
248
-
249
- // /**
250
- // * Invokes the setter on the provided receiver.
251
- // *
252
- // * @example
253
- // * context.access.set.call(instance, value);
254
- // */
255
- // set(this: This, value: Value): void;
256
- // };
247
+ /** An object that can be used to access the current value of the class element at runtime. */
248
+ readonly access: {
249
+ /**
250
+ * Determines whether an object has a property with the same name as the decorated element.
251
+ */
252
+ has(object: This): boolean;
253
+
254
+ /**
255
+ * Invokes the getter on the provided object.
256
+ *
257
+ * @example
258
+ * let value = context.access.get(instance);
259
+ */
260
+ get(object: This): Value;
261
+
262
+ /**
263
+ * Invokes the setter on the provided object.
264
+ *
265
+ * @example
266
+ * context.access.set(instance, value);
267
+ */
268
+ set(object: This, value: Value): void;
269
+ };
257
270
 
258
271
  /**
259
272
  * Adds a callback to be invoked either before static initializers are run (when
260
- * decorating a `static` member), or before instance initializers are run (when
261
- * decorating a non-`static` member).
273
+ * decorating a `static` element), or before instance initializers are run (when
274
+ * decorating a non-`static` element).
262
275
  */
263
276
  addInitializer(initializer: (this: This) => void): void;
264
277
  }
@@ -320,36 +333,40 @@ interface ClassFieldDecoratorContext<
320
333
  This = unknown,
321
334
  Value = unknown,
322
335
  > {
323
- /** The kind of class member that was decorated. */
336
+ /** The kind of class element that was decorated. */
324
337
  readonly kind: "field";
325
338
 
326
- /** The name of the decorated class member. */
339
+ /** The name of the decorated class element. */
327
340
  readonly name: string | symbol;
328
341
 
329
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
342
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
330
343
  readonly static: boolean;
331
344
 
332
- /** A value indicating whether the class member has a private name. */
345
+ /** A value indicating whether the class element has a private name. */
333
346
  readonly private: boolean;
334
347
 
335
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
336
- // /** An object that can be used to access the current value of the class member at runtime. */
337
- // readonly access: {
338
- // /**
339
- // * Gets the value of the field on the provided receiver.
340
- // */
341
- // get(this: This): Value;
348
+ /** An object that can be used to access the current value of the class element at runtime. */
349
+ readonly access: {
350
+ /**
351
+ * Determines whether an object has a property with the same name as the decorated element.
352
+ */
353
+ has(object: This): boolean;
342
354
 
343
- // /**
344
- // * Sets the value of the field on the provided receiver.
345
- // */
346
- // set(this: This, value: Value): void;
347
- // };
355
+ /**
356
+ * Gets the value of the field on the provided object.
357
+ */
358
+ get(object: This): Value;
359
+
360
+ /**
361
+ * Sets the value of the field on the provided object.
362
+ */
363
+ set(object: This, value: Value): void;
364
+ };
348
365
 
349
366
  /**
350
367
  * Adds a callback to be invoked either before static initializers are run (when
351
- * decorating a `static` member), or before instance initializers are run (when
352
- * decorating a non-`static` member).
368
+ * decorating a `static` element), or before instance initializers are run (when
369
+ * decorating a non-`static` element).
353
370
  */
354
371
  addInitializer(initializer: (this: This) => void): void;
355
372
  }