Skip to content

Escape character / doesn't work in rescript 10 in %raw templates #6236

Open
@JasoonS

Description

@JasoonS

Please see more details here: https://forum.rescript-lang.org/t/string-interpolations-in-raw/871/8?u=jasoons

Example:

%%raw(`
// look ma, regular JavaScript!
var message = \`\${"hello"}\`;
function greet(m) {
  console.log(m)
}
`)

In rescript 9 this produces:

// look ma, regular JavaScript!
var message = `${"hello"}`;
function greet(m) {
  console.log(m)
}

But in rescript >= 10 it produces:

// look ma, regular JavaScript!
var message = \`\${"hello"}\`;
function greet(m) {
  console.log(m)
}

You can reproduce this by adjusting the rescript version in the playground settings: https://rescript-lang.org/try?code=KTBOEMHcAoAMCgD0iAEAbA9hg1igtuADQqgCmA5gK5rigoBS4AbuAMoDGoAlgA4AuAQngs6eUgGdx4cqRQBeFAB1YigCQBvAEQALUmkyaAvsoDc8AGaUAduz5cMVlOTKk+0PAEoU6+ChTsHcQw0UgA6THJ3D3hDeFgPIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions