Skip to content

TypeScript cells does not handle expressions correctly #86

@mbostock

Description

@mbostock

The new TypeScript cells added in 1.4.0 don’t handle expressions correctly; the TypeScript transpiler interprets all input as a program, and hence promotes an expression to an expression statement. This in turn means that implicit display is disabled. So this:

1 + 2

Becomes this:

1 + 2;

A more severe case is that expressions can be misinterpreted. This:

{x: "foo"}

Is incorrectly converted into a block statement containing a label statement:

{
    x: "foo";
}

Whereas the intended interpretation is an object literal expression:

({x: "foo"})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions