Skip to content

Commit 33ebade

Browse files
committed
fixup! fix code snippets in tsdoc
1 parent 3db53b7 commit 33ebade

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
@@ -180,14 +180,14 @@ export class Context {
180180
*
181181
* ```ts
182182
* // get the value bound to "application.instance"
183-
* const app = await ctx.get('application.instance');
183+
* const app = await ctx.get<Application>('application.instance');
184184
*
185185
* // 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');
187187
*
188188
* // get "a" property of "numbers" property from the value bound to "data"
189189
* 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');
191191
* ```
192192
*
193193
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -205,7 +205,9 @@ export class Context {
205205
* ```ts
206206
* // get "rest" property from the value bound to "config"
207207
* // 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+
* });
209211
* ```
210212
*
211213
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -252,10 +254,10 @@ export class Context {
252254
*
253255
* ```ts
254256
* // get the value bound to "application.instance"
255-
* const app = ctx.get('application.instance');
257+
* const app = ctx.getSync<Application>('application.instance');
256258
*
257259
* // 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');
259261
* ```
260262
*
261263
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -278,8 +280,10 @@ export class Context {
278280
*
279281
* ```ts
280282
* // 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+
* });
283287
* ```
284288
*
285289
* @param keyWithPath The binding key, optionally suffixed with a path to the
@@ -361,14 +365,14 @@ export class Context {
361365
*
362366
* ```ts
363367
* // get the value bound to "application.instance"
364-
* ctx.getValueOrPromise('application.instance');
368+
* ctx.getValueOrPromise<Application>('application.instance');
365369
*
366370
* // get "rest" property from the value bound to "config"
367-
* ctx.getValueOrPromise('config#rest');
371+
* ctx.getValueOrPromise<RestComponentConfig>('config#rest');
368372
*
369373
* // get "a" property of "numbers" property from the value bound to "data"
370374
* ctx.bind('data').to({numbers: {a: 1, b: 2}, port: 3000});
371-
* ctx.getValueOrPromise('data#numbers.a');
375+
* ctx.getValueOrPromise<number>('data#numbers.a');
372376
* ```
373377
*
374378
* @param keyWithPath The binding key, optionally suffixed with a path to the

0 commit comments

Comments
 (0)