Skip to content

Template string arguments are merging into one #716

@kot-shrodingera

Description

@kot-shrodingera

Code example

const tag = (strings, ...args) => {
  return strings.raw
};

tag`begin${'first'}middle${'second'}end`;

Expected output is ["begin", "middle", "end"] (with args[0] = "first" and args[1] = "middle")
But current output is ["", ""] (with args[0] = "beginfirstmiddlesecondend")
This is because code is obfuscating into this (with simplest settings):

const tag = (a, ...b) => {
    return a['raw'];
};
tag`${ 'begin' + 'first' + 'middle' + 'second' + 'end' }`;

I'm using tag functions and need to distinguish parts of template strings, but with such behavior it doesn't work
Sorry for bad English

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions