FIx unneeded defensive code
This commit is contained in:
@@ -272,23 +272,17 @@ export class ConfigReader implements Config {
|
||||
if (value === undefined) {
|
||||
return this.fallback?.readConfigValue(key, validate);
|
||||
}
|
||||
if (value !== undefined) {
|
||||
const result = validate(value);
|
||||
if (result !== true) {
|
||||
const {
|
||||
key: keyName = key,
|
||||
value: theValue = value,
|
||||
const result = validate(value);
|
||||
if (result !== true) {
|
||||
const { key: keyName = key, value: theValue = value, expected } = result;
|
||||
throw new TypeError(
|
||||
errors.type(
|
||||
this.fullKey(keyName),
|
||||
this.context,
|
||||
typeOf(theValue),
|
||||
expected,
|
||||
} = result;
|
||||
throw new TypeError(
|
||||
errors.type(
|
||||
this.fullKey(keyName),
|
||||
this.context,
|
||||
typeOf(theValue),
|
||||
expected,
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return value as T;
|
||||
|
||||
Reference in New Issue
Block a user