File tree 3 files changed +4
-4
lines changed
3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ store along with the key. For example:
132
132
// app level
133
133
const app = new Application ();
134
134
app .bind (' hello' ).to (' world' ); // ContextKey='hello', ContextValue='world'
135
- console .log (app .getSync (' hello' )); // => 'world'
135
+ console .log (app .getSync < string > (' hello' )); // => 'world'
136
136
```
137
137
138
138
In this case, we bind the 'world' string ContextValue to the 'hello' ContextKey.
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ Syntax: `@inject.tag(tag: string | RegExp)`.
290
290
.bind (' store.locations.sj' )
291
291
.to (' San Jose' )
292
292
.tag (' store:location' );
293
- const store: Store = ctx .getSync (' store' );
293
+ const store = ctx .getSync < Store > (' store' );
294
294
// `store.locations` is now `['San Francisco', 'San Jose']`
295
295
```
296
296
@@ -305,7 +305,7 @@ Syntax: `@inject.context()`.
305
305
306
306
const ctx = new Context ();
307
307
ctx .bind (' my-component' ).toClass (MyComponent );
308
- const component: MyComponent = ctx .getSync (' my-component' );
308
+ const component = ctx .getSync < MyComponent > (' my-component' );
309
309
// `component.ctx` should be the same as `ctx`
310
310
```
311
311
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ ctx.bind('utilities.PasswordHash').to((password) => { /* ... */ })
64
64
ctx .bind (' controllers.UserController' ).toClass (UserController );
65
65
66
66
// Locate the an instance of UserController from the context
67
- const userController: UserController = await ctx .get (' controller.UserController' );
67
+ const userController= await ctx .get < UserController > (' controller.UserController' );
68
68
// Run the log()
69
69
const ok = await logger .login (' John' , ' MyPassWord' );
70
70
```
You can’t perform that action at this time.
0 commit comments