@@ -207,14 +207,14 @@ export class Context {
207
207
*
208
208
* ```ts
209
209
* // get the value bound to "application.instance"
210
- * const app = await ctx.get('application.instance');
210
+ * const app = await ctx.get<Application> ('application.instance');
211
211
*
212
212
* // get "rest" property from the value bound to "config"
213
- * const config = await ctx.getValueOrPromise ('config#rest');
213
+ * const config = await ctx.get<RestComponentConfig> ('config#rest');
214
214
*
215
215
* // get "a" property of "numbers" property from the value bound to "data"
216
216
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000 });
217
- * const a = await ctx.get('data#numbers.a');
217
+ * const a = await ctx.get<number> ('data#numbers.a');
218
218
* ```
219
219
*
220
220
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -232,7 +232,9 @@ export class Context {
232
232
* ```ts
233
233
* // get "rest" property from the value bound to "config"
234
234
* // use "undefined" when not config was provided
235
- * const config = await ctx.get('config#rest', {optional: true});
235
+ * const config = await ctx.get<RestComponentConfig>('config#rest', {
236
+ * optional: true
237
+ * });
236
238
* ```
237
239
*
238
240
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -279,10 +281,10 @@ export class Context {
279
281
*
280
282
* ```ts
281
283
* // get the value bound to "application.instance"
282
- * const app = ctx.get ('application.instance');
284
+ * const app = ctx.getSync<Application> ('application.instance');
283
285
*
284
286
* // get "rest" property from the value bound to "config"
285
- * const config = ctx.getValueOrPromise ('config#rest');
287
+ * const config = await ctx.getSync<RestComponentConfig> ('config#rest');
286
288
* ```
287
289
*
288
290
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -305,8 +307,10 @@ export class Context {
305
307
*
306
308
* ```ts
307
309
* // get "rest" property from the value bound to "config"
308
- * // use "undefined" when not config was provided
309
- * const config = await ctx.getSync('config#rest', {optional: true});
310
+ * // use "undefined" when no config was provided
311
+ * const config = await ctx.getSync<RestComponentConfig>('config#rest', {
312
+ * optional: true
313
+ * });
310
314
* ```
311
315
*
312
316
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -388,14 +392,14 @@ export class Context {
388
392
*
389
393
* ```ts
390
394
* // get the value bound to "application.instance"
391
- * ctx.getValueOrPromise('application.instance');
395
+ * ctx.getValueOrPromise<Application> ('application.instance');
392
396
*
393
397
* // get "rest" property from the value bound to "config"
394
- * ctx.getValueOrPromise('config#rest');
398
+ * ctx.getValueOrPromise<RestComponentConfig> ('config#rest');
395
399
*
396
400
* // get "a" property of "numbers" property from the value bound to "data"
397
401
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000 });
398
- * ctx.getValueOrPromise('data#numbers.a');
402
+ * ctx.getValueOrPromise<number> ('data#numbers.a');
399
403
* ```
400
404
*
401
405
* @param keyWithPath The binding key, optionally suffixed with a path to the
0 commit comments