Skip to content

Commit 741a1f0

Browse files
fix: ensure phrase is a string (COR-10013)
1 parent f36349e commit 741a1f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/common/src/utils/variables.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export function replaceVariables(
8484
keepTypeIfOnlyVariable = false,
8585
}: { modifier?: ((variable: unknown) => unknown) | undefined; trim?: boolean; keepTypeIfOnlyVariable?: boolean } = {}
8686
): string | unknown {
87-
const formattedPhrase = trim ? phrase?.trim() : phrase;
87+
const stringPhrase = typeof phrase === 'string' ? phrase : String(phrase ?? '');
88+
89+
const formattedPhrase = trim ? stringPhrase.trim() : stringPhrase;
8890

8991
if (!formattedPhrase) {
9092
return '';

0 commit comments

Comments
 (0)