@@ -309,13 +309,13 @@ export class BindingBuilder {
|
||||
* expect(injector.get(String)).toEqual('Hello');
|
||||
* ```
|
||||
*/
|
||||
toValue(value): Binding { return new Binding(this.token, {toValue: value}); }
|
||||
toValue(value: any): Binding { return new Binding(this.token, {toValue: value}); }
|
||||
|
||||
/**
|
||||
* Binds a key to the alias for an existing key.
|
||||
*
|
||||
* An alias means that we will return the same instance as if the alias token was used. (This is
|
||||
* in contrast to `toClass` where a separet instance of `toClass` will be returned.)
|
||||
* in contrast to `toClass` where a separate instance of `toClass` will be returned.)
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
@@ -344,7 +344,7 @@ export class BindingBuilder {
|
||||
* expect(injectorClass.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
toAlias(aliasToken): Binding {
|
||||
toAlias(aliasToken: /*Type*/ any): Binding {
|
||||
if (isBlank(aliasToken)) {
|
||||
throw new BaseException(`Can not alias ${stringify(this.token)} to a blank value!`);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export class AbstractBindingError extends BaseException {
|
||||
}
|
||||
|
||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||
addKey(key): void {
|
||||
addKey(key: any): void {
|
||||
this.keys.push(key);
|
||||
this.message = this.constructResolvingMessage(this.keys);
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ export class Injector {
|
||||
*binding).
|
||||
* @returns an instance represented by the token. Throws if not found.
|
||||
*/
|
||||
get(token): any {
|
||||
get(token: any): any {
|
||||
return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, false, PUBLIC_AND_PRIVATE);
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ export class Injector {
|
||||
* @param `token`: usually a `Type`. (Same as the token used while setting up a binding).
|
||||
* @returns an instance represented by the token. Returns `null` if not found.
|
||||
*/
|
||||
getOptional(token): any {
|
||||
getOptional(token: any): any {
|
||||
return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, true, PUBLIC_AND_PRIVATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class Key {
|
||||
/**
|
||||
* Retrieves a `Key` for a token.
|
||||
*/
|
||||
static get(token): Key { return _globalKeyRegistry.get(resolveForwardRef(token)); }
|
||||
static get(token: Object): Key { return _globalKeyRegistry.get(resolveForwardRef(token)); }
|
||||
|
||||
/**
|
||||
* @returns the number of keys registered in the system.
|
||||
|
||||
Reference in New Issue
Block a user