@@ -180,14 +180,14 @@ export class Context {
180
180
*
181
181
* ```ts
182
182
* // get the value bound to "application.instance"
183
- * const app = await ctx.get('application.instance');
183
+ * const app = await ctx.get<Application> ('application.instance');
184
184
*
185
185
* // get "rest" property from the value bound to "config"
186
- * const config = await ctx.getValueOrPromise ('config#rest');
186
+ * const config = await ctx.get<RestComponentConfig> ('config#rest');
187
187
*
188
188
* // get "a" property of "numbers" property from the value bound to "data"
189
189
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000 });
190
- * const a = await ctx.get('data#numbers.a');
190
+ * const a = await ctx.get<number> ('data#numbers.a');
191
191
* ```
192
192
*
193
193
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -205,7 +205,9 @@ export class Context {
205
205
* ```ts
206
206
* // get "rest" property from the value bound to "config"
207
207
* // use "undefined" when not config was provided
208
- * const config = await ctx.get('config#rest', {optional: true});
208
+ * const config = await ctx.get<RestComponentConfig>('config#rest', {
209
+ * optional: true
210
+ * });
209
211
* ```
210
212
*
211
213
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -252,10 +254,10 @@ export class Context {
252
254
*
253
255
* ```ts
254
256
* // get the value bound to "application.instance"
255
- * const app = ctx.get ('application.instance');
257
+ * const app = ctx.getSync<Application> ('application.instance');
256
258
*
257
259
* // get "rest" property from the value bound to "config"
258
- * const config = ctx.getValueOrPromise ('config#rest');
260
+ * const config = await ctx.getSync<RestComponentConfig> ('config#rest');
259
261
* ```
260
262
*
261
263
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -278,8 +280,10 @@ export class Context {
278
280
*
279
281
* ```ts
280
282
* // get "rest" property from the value bound to "config"
281
- * // use "undefined" when not config was provided
282
- * const config = await ctx.getSync('config#rest', {optional: true});
283
+ * // use "undefined" when no config was provided
284
+ * const config = await ctx.getSync<RestComponentConfig>('config#rest', {
285
+ * optional: true
286
+ * });
283
287
* ```
284
288
*
285
289
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -361,14 +365,14 @@ export class Context {
361
365
*
362
366
* ```ts
363
367
* // get the value bound to "application.instance"
364
- * ctx.getValueOrPromise('application.instance');
368
+ * ctx.getValueOrPromise<Application> ('application.instance');
365
369
*
366
370
* // get "rest" property from the value bound to "config"
367
- * ctx.getValueOrPromise('config#rest');
371
+ * ctx.getValueOrPromise<RestComponentConfig> ('config#rest');
368
372
*
369
373
* // get "a" property of "numbers" property from the value bound to "data"
370
374
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000 });
371
- * ctx.getValueOrPromise('data#numbers.a');
375
+ * ctx.getValueOrPromise<number> ('data#numbers.a');
372
376
* ```
373
377
*
374
378
* @param keyWithPath The binding key, optionally suffixed with a path to the
0 commit comments