Skip to content

Template string expression statement leading with object literal gives incorrect emit #4912

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Something like

`${ { hello: 10; world: 20 } }HELLO`

will get emitted as

{ hello: 10; world: 20 } + "HELLO"

As an expresssion statement, the former evaluates to "[object Object]HELLO" while the latter evaluates to NaN.

This is because the former gets parsed as:

// block body
{
    hello: 10;
    world: 20;
};
"HELLO";

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions