return value;
}
if (isString(value) || typeof value === 'number') {
- return new Date(value);
+ return new Date(value!);
}
return null;
};
changedValue = parseInt(value as string);
}
if (isNaN(changedValue)) {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
throw new Error(`Cannot convert to integer: ${value.toString()}`);
}
return changedValue;
changedValue = parseFloat(value as string);
}
if (isNaN(changedValue)) {
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
throw new Error(`Cannot convert to float: ${value.toString()}`);
}
return changedValue;
};
export const isIterable = <T>(obj: T): boolean => {
- return !isNullOrUndefined(obj) ? typeof obj[Symbol.iterator] === 'function' : false;
+ return !isNullOrUndefined(obj) ? typeof obj[Symbol.iterator as keyof T] === 'function' : false;
};
const isString = (value: unknown): boolean => {
return '(For applications)';
}
}
- if (!isUndefined(WebSocketCloseEventStatusString[code])) {
- return WebSocketCloseEventStatusString[code] as string;
+ if (
+ !isUndefined(
+ WebSocketCloseEventStatusString[code as keyof typeof WebSocketCloseEventStatusString],
+ )
+ ) {
+ return WebSocketCloseEventStatusString[code as keyof typeof WebSocketCloseEventStatusString];
}
return '(Unknown)';
};