File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,9 @@ export function removeNameAndKeyTags(binding: Binding<unknown>) {
136
136
*
137
137
* @param cls A class with optional `@bind`
138
138
*/
139
- export function bindingTemplateFor ( cls : Constructor < unknown > ) : BindingTemplate {
139
+ export function bindingTemplateFor < T = unknown > (
140
+ cls : Constructor < T | Provider < T > > ,
141
+ ) : BindingTemplate < T > {
140
142
const spec = getBindingMetadata ( cls ) ;
141
143
const templateFunctions = ( spec && spec . templates ) || [
142
144
asClassOrProvider ( cls ) ,
@@ -198,16 +200,16 @@ export type BindingFromClassOptions = {
198
200
* @param cls A class
199
201
* @param options Options to customize the binding key
200
202
*/
201
- export function createBindingFromClass (
202
- cls : Constructor < unknown > ,
203
+ export function createBindingFromClass < T = unknown > (
204
+ cls : Constructor < T | Provider < T > > ,
203
205
options : BindingFromClassOptions = { } ,
204
- ) : Binding {
206
+ ) : Binding < T > {
205
207
const templateFn = bindingTemplateFor ( cls ) ;
206
208
let key = options . key ;
207
209
if ( ! key ) {
208
210
key = buildBindingKey ( cls , options ) ;
209
211
}
210
- const binding = Binding . bind ( key ) . apply ( templateFn ) ;
212
+ const binding = Binding . bind < T > ( key ) . apply ( templateFn ) ;
211
213
if ( options . name ) {
212
214
binding . tag ( { name : options . name } ) ;
213
215
}
Original file line number Diff line number Diff line change @@ -473,7 +473,7 @@ export class Binding<T = BoundValue> {
473
473
* easy to read.
474
474
* @param key Binding key
475
475
*/
476
- static bind < T = unknown > ( key : BindingAddress < T > ) : Binding {
476
+ static bind < T = unknown > ( key : BindingAddress < T > ) : Binding < T > {
477
477
return new Binding ( key . toString ( ) ) ;
478
478
}
479
479
}
You can’t perform that action at this time.
0 commit comments