refValue
@tsed/di
Usage
typescript
import { refValue } from "@tsed/di";
Overview
ts
function refValue<Type>(expression: string): {
value: Type | undefined;
};
export function refValue<Type>(expression: string, defaultValue: Type | undefined): {
value: Type;
};
Description
Get a value from the injector.settings
.
Example
ts
import {refValue, Injectable} from "@tsed/di";
@Injectable()
class Test {
test = refValue("logger.level", "default value");
constructor() {
console.log(this.test.value); // "off"
}
}
@param expression The expression to get the value from the `injector.settings`.
<!-- Members -->
## value
```ts
value: Type | undefined;
value
ts
value: Type;