* Resolve configuration synchronously for the binding by key * * @param key - Binding key * @param propertyPath - Property path for the option. For example, `x.y` * requests for `config.x.y`. If not set, the `config` object will be * returned. * @param resolutionOptions - Options f
(
key: BindingAddress,
propertyPath?: string,
resolutionOptions?: ResolutionOptions,
)
| 352 | * @param resolutionOptions - Options for the resolution. |
| 353 | */ |
| 354 | getConfigSync<ConfigValueType>( |
| 355 | key: BindingAddress, |
| 356 | propertyPath?: string, |
| 357 | resolutionOptions?: ResolutionOptions, |
| 358 | ): ConfigValueType | undefined { |
| 359 | const valueOrPromise = this.getConfigAsValueOrPromise<ConfigValueType>( |
| 360 | key, |
| 361 | propertyPath, |
| 362 | resolutionOptions, |
| 363 | ); |
| 364 | if (isPromiseLike(valueOrPromise)) { |
| 365 | const prop = propertyPath ? ` property ${propertyPath}` : ''; |
| 366 | throw new Error( |
| 367 | `Cannot get config${prop} for ${key} synchronously: the value is a promise`, |
| 368 | ); |
| 369 | } |
| 370 | return valueOrPromise; |
| 371 | } |
| 372 | |
| 373 | /** |
| 374 | * Unbind a binding from the context. No parent contexts will be checked. |
no test coverage detected