diff --git a/packages/string-templates/src/helpers/index.ts b/packages/string-templates/src/helpers/index.ts index e95ac9d2fd..595440ad55 100644 --- a/packages/string-templates/src/helpers/index.ts +++ b/packages/string-templates/src/helpers/index.ts @@ -51,11 +51,11 @@ const HELPERS = [ if (value && (value as any).string) { value = (value as any).string } - let text = value + let text: any = value if (__opts && __opts.escapeNewlines) { text = value.replace(/\n/g, "\\n") } - text = new SafeString(text.replace(/&/g, "&")).toString() + text = new SafeString(text.replace(/&/g, "&")) if (text == null || typeof text !== "string") { return text } diff --git a/packages/string-templates/test/helpers.spec.ts b/packages/string-templates/test/helpers.spec.ts index efa6b0fdc3..f66eb9ef33 100644 --- a/packages/string-templates/test/helpers.spec.ts +++ b/packages/string-templates/test/helpers.spec.ts @@ -342,14 +342,14 @@ describe("Test the literal helper", () => { }) it("should allow use of the literal specifier for an object", async () => { - const output = await processString(`{{literal a}}`, { + const output: any = await processString(`{{literal a}}`, { a: { b: 1 }, }) expect(output.b).toBe(1) }) it("should allow use of the literal specifier for an object with dashes", async () => { - const output = await processString(`{{literal a}}`, { + const output: any = await processString(`{{literal a}}`, { a: { b: "i-have-dashes" }, }) expect(output.b).toBe("i-have-dashes")