Skip to content

Commit 255a8ae

Browse files
authored
fix: Correct single value typing, IEnvAware variant (#101)
1 parent 97a6a72 commit 255a8ae

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/dataSources/SingleValueDataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function buildDictionary(key: string | (() => Promise<[string, ConfigurationValu
1212
};
1313
if (typeof key === 'function') {
1414
return async () => {
15-
const [k, v] = await (key as (() => Promise<[string, ConfigurationValue]>))();
15+
const [k, v] = await key();
1616
return dicFn(k, v);
1717
};
1818
}

src/wj-config.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,13 @@ export interface IEnvAwareBuilder<TEnvironments extends string, T extends Record
369369
* @param value Value of the property.
370370
* @param hierarchySeparator Optional hierarchy separator. If not specified, colon (:) is assumed.
371371
*/
372-
addSingleValue<TKey extends string, TValue extends ConfigurationValue, TSep extends string = ':'>(path: string, value?: ConfigurationValue, hierarchySeparator?: string): IEnvAwareBuilder<TEnvironments, MergeResult<T, InflateKey<TKey, TValue, TSep>>>;
372+
addSingleValue<TKey extends string, TValue extends ConfigurationValue, TSep extends string = ':'>(path: TKey, value?: ConfigurationValue, hierarchySeparator?: string): IEnvAwareBuilder<TEnvironments, MergeResult<T, InflateKey<TKey, TValue, TSep>>>;
373373
/**
374374
* Adds a single value to the collection of data sources that will be used to build the configuration object.
375375
* @param dataFn Function that returns the [key, value] tuple that needs to be added.
376376
* @param hierarchySeparator Optional hierarchy separator. If not specified, colon (:) is assumed.
377377
*/
378-
addSingleValue<TKey extends string, TValue extends ConfigurationValue, TSep extends string = ':'>(dataFn: () => Promise<[string, ConfigurationValue]>, hierarchySeparator?: string): IEnvAwareBuilder<TEnvironments, MergeResult<T, InflateKey<TKey, TValue, TSep>>>;
378+
addSingleValue<TKey extends string, TValue extends ConfigurationValue, TSep extends string = ':'>(dataFn: () => Promise<[TKey, ConfigurationValue]>, hierarchySeparator?: string): IEnvAwareBuilder<TEnvironments, MergeResult<T, InflateKey<TKey, TValue, TSep>>>;
379379
/**
380380
* Sets the data source name of the last data source added to the builder.
381381
* @param name Name for the data source.

0 commit comments

Comments
 (0)