diff --git a/lib/Core/replaceUnderscores.ts b/lib/Core/replaceUnderscores.ts index 693deb2388..c8772e389f 100644 --- a/lib/Core/replaceUnderscores.ts +++ b/lib/Core/replaceUnderscores.ts @@ -3,8 +3,10 @@ * @param string The string to replace. If the argument is not a string, does nothing. * @return The argument with all underscores replaced with spaces. If the argument is not a string, returns the argument unchanged. */ -function replaceUnderscores(str: string | undefined): typeof str { - return typeof str === "string" ? str.replace(/_/g, " ") : str; +function replaceUnderscores(str: any): typeof str { + return typeof str === "string" || str instanceof String + ? str.replace(/_/g, " ") + : str; } export default replaceUnderscores;