Skip to content

Commit 5c9496f

Browse files
committed
fixup! fix code snippets in tsdoc
1 parent 5c206b5 commit 5c9496f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

packages/context/src/context.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ export class Context {
207207
*
208208
* ```ts
209209
* // get the value bound to "application.instance"
210-
* const app = await ctx.get('application.instance');
210+
* const app = await ctx.get<Application>('application.instance');
211211
*
212212
* // 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');
214214
*
215215
* // get "a" property of "numbers" property from the value bound to "data"
216216
* 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');
218218
* ```
219219
*
220220
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -232,7 +232,9 @@ export class Context {
232232
* ```ts
233233
* // get "rest" property from the value bound to "config"
234234
* // 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+
* });
236238
* ```
237239
*
238240
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -279,10 +281,10 @@ export class Context {
279281
*
280282
* ```ts
281283
* // get the value bound to "application.instance"
282-
* const app = ctx.get('application.instance');
284+
* const app = ctx.getSync<Application>('application.instance');
283285
*
284286
* // 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');
286288
* ```
287289
*
288290
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -305,8 +307,10 @@ export class Context {
305307
*
306308
* ```ts
307309
* // 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+
* });
310314
* ```
311315
*
312316
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -388,14 +392,14 @@ export class Context {
388392
*
389393
* ```ts
390394
* // get the value bound to "application.instance"
391-
* ctx.getValueOrPromise('application.instance');
395+
* ctx.getValueOrPromise<Application>('application.instance');
392396
*
393397
* // get "rest" property from the value bound to "config"
394-
* ctx.getValueOrPromise('config#rest');
398+
* ctx.getValueOrPromise<RestComponentConfig>('config#rest');
395399
*
396400
* // get "a" property of "numbers" property from the value bound to "data"
397401
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000});
398-
* ctx.getValueOrPromise('data#numbers.a');
402+
* ctx.getValueOrPromise<number>('data#numbers.a');
399403
* ```
400404
*
401405
* @param keyWithPath The binding key, optionally suffixed with a path to the

0 commit comments

Comments
 (0)