@@ -14,12 +14,10 @@ and limitations under the License.
1414***************************************************************************** */
1515
1616
17-
1817/// <reference no-default-lib="true"/>
1918
20-
2119/**
22- * The decorator context types provided to class member decorators.
20+ * The decorator context types provided to class element decorators.
2321 */
2422type ClassMemberDecoratorContext =
2523 | ClassMethodDecoratorContext
@@ -80,34 +78,37 @@ interface ClassMethodDecoratorContext<
8078 This = unknown ,
8179 Value extends ( this : This , ...args : any ) => any = ( this : This , ...args : any ) => any ,
8280> {
83- /** The kind of class member that was decorated. */
81+ /** The kind of class element that was decorated. */
8482 readonly kind : "method" ;
8583
86- /** The name of the decorated class member . */
84+ /** The name of the decorated class element . */
8785 readonly name : string | symbol ;
8886
89- /** 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 . */
9088 readonly static : boolean ;
9189
92- /** A value indicating whether the class member has a private name. */
90+ /** A value indicating whether the class element has a private name. */
9391 readonly private : boolean ;
9492
95- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
96- // /** An object that can be used to access the current value of the class member at runtime. */
97- // readonly access: {
98- // /**
99- // * Gets the current value of the method from the provided receiver.
100- // *
101- // * @example
102- // * let fn = context.access.get.call(instance);
103- // */
104- // get(this: This): Value;
105- // };
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+ } ;
106107
107108 /**
108109 * Adds a callback to be invoked either before static initializers are run (when
109- * decorating a `static` member ), or before instance initializers are run (when
110- * decorating a non-`static` member ).
110+ * decorating a `static` element ), or before instance initializers are run (when
111+ * decorating a non-`static` element ).
111112 *
112113 * @example
113114 * ```ts
@@ -141,34 +142,37 @@ interface ClassGetterDecoratorContext<
141142 This = unknown ,
142143 Value = unknown ,
143144> {
144- /** The kind of class member that was decorated. */
145+ /** The kind of class element that was decorated. */
145146 readonly kind : "getter" ;
146147
147- /** The name of the decorated class member . */
148+ /** The name of the decorated class element . */
148149 readonly name : string | symbol ;
149150
150- /** 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 . */
151152 readonly static : boolean ;
152153
153- /** A value indicating whether the class member has a private name. */
154+ /** A value indicating whether the class element has a private name. */
154155 readonly private : boolean ;
155156
156- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
157- // /** An object that can be used to access the current value of the class member at runtime. */
158- // readonly access: {
159- // /**
160- // * Invokes the getter on the provided receiver.
161- // *
162- // * @example
163- // * let value = context.access.get.call(instance);
164- // */
165- // get(this: This): Value;
166- // };
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+ } ;
167171
168172 /**
169173 * Adds a callback to be invoked either before static initializers are run (when
170- * decorating a `static` member ), or before instance initializers are run (when
171- * decorating a non-`static` member ).
174+ * decorating a `static` element ), or before instance initializers are run (when
175+ * decorating a non-`static` element ).
172176 */
173177 addInitializer ( initializer : ( this : This ) => void ) : void ;
174178}
@@ -183,34 +187,37 @@ interface ClassSetterDecoratorContext<
183187 This = unknown ,
184188 Value = unknown ,
185189> {
186- /** The kind of class member that was decorated. */
190+ /** The kind of class element that was decorated. */
187191 readonly kind : "setter" ;
188192
189- /** The name of the decorated class member . */
193+ /** The name of the decorated class element . */
190194 readonly name : string | symbol ;
191195
192- /** 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 . */
193197 readonly static : boolean ;
194198
195- /** A value indicating whether the class member has a private name. */
199+ /** A value indicating whether the class element has a private name. */
196200 readonly private : boolean ;
197201
198- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
199- /** An object that can be used to access the current value of the class member at runtime. */
200- // readonly access: {
201- // /**
202- // * Invokes the setter on the provided receiver.
203- // *
204- // * @example
205- // * context.access.set.call(instance, value);
206- // */
207- // set(this: This, value: Value): void;
208- // };
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+ } ;
209216
210217 /**
211218 * Adds a callback to be invoked either before static initializers are run (when
212- * decorating a `static` member ), or before instance initializers are run (when
213- * decorating a non-`static` member ).
219+ * decorating a `static` element ), or before instance initializers are run (when
220+ * decorating a non-`static` element ).
214221 */
215222 addInitializer ( initializer : ( this : This ) => void ) : void ;
216223}
@@ -225,42 +232,46 @@ interface ClassAccessorDecoratorContext<
225232 This = unknown ,
226233 Value = unknown ,
227234> {
228- /** The kind of class member that was decorated. */
235+ /** The kind of class element that was decorated. */
229236 readonly kind : "accessor" ;
230237
231- /** The name of the decorated class member . */
238+ /** The name of the decorated class element . */
232239 readonly name : string | symbol ;
233240
234- /** 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 . */
235242 readonly static : boolean ;
236243
237- /** A value indicating whether the class member has a private name. */
244+ /** A value indicating whether the class element has a private name. */
238245 readonly private : boolean ;
239246
240- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
241- // /** An object that can be used to access the current value of the class member at runtime. */
242- // readonly access: {
243- // /**
244- // * Invokes the getter on the provided receiver.
245- // *
246- // * @example
247- // * let value = context.access.get.call(instance);
248- // */
249- // get(this: This): Value;
250-
251- // /**
252- // * Invokes the setter on the provided receiver.
253- // *
254- // * @example
255- // * context.access.set.call(instance, value);
256- // */
257- // set(this: This, value: Value): void;
258- // };
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+ } ;
259270
260271 /**
261272 * Adds a callback to be invoked either before static initializers are run (when
262- * decorating a `static` member ), or before instance initializers are run (when
263- * decorating a non-`static` member ).
273+ * decorating a `static` element ), or before instance initializers are run (when
274+ * decorating a non-`static` element ).
264275 */
265276 addInitializer ( initializer : ( this : This ) => void ) : void ;
266277}
@@ -322,36 +333,40 @@ interface ClassFieldDecoratorContext<
322333 This = unknown ,
323334 Value = unknown ,
324335> {
325- /** The kind of class member that was decorated. */
336+ /** The kind of class element that was decorated. */
326337 readonly kind : "field" ;
327338
328- /** The name of the decorated class member . */
339+ /** The name of the decorated class element . */
329340 readonly name : string | symbol ;
330341
331- /** 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 . */
332343 readonly static : boolean ;
333344
334- /** A value indicating whether the class member has a private name. */
345+ /** A value indicating whether the class element has a private name. */
335346 readonly private : boolean ;
336347
337- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
338- // /** An object that can be used to access the current value of the class member at runtime. */
339- // readonly access: {
340- // /**
341- // * Gets the value of the field on the provided receiver.
342- // */
343- // 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 ;
354+
355+ /**
356+ * Gets the value of the field on the provided object.
357+ */
358+ get ( object : This ) : Value ;
344359
345- // /**
346- // * Sets the value of the field on the provided receiver .
347- // */
348- // set(this : This, value: Value): void;
349- // };
360+ /**
361+ * Sets the value of the field on the provided object .
362+ */
363+ set ( object : This , value : Value ) : void ;
364+ } ;
350365
351366 /**
352367 * Adds a callback to be invoked either before static initializers are run (when
353- * decorating a `static` member ), or before instance initializers are run (when
354- * decorating a non-`static` member ).
368+ * decorating a `static` element ), or before instance initializers are run (when
369+ * decorating a non-`static` element ).
355370 */
356371 addInitializer ( initializer : ( this : This ) => void ) : void ;
357372}
0 commit comments