Skip to content

template syntax breaks on curious combination of five conditions #142

Open
@qbalukom

Description

@qbalukom

To achieve the bug, following must be met:

  • assignment to a variable (or as a parameter in a function call)
  • right side must be an object
  • on the value side of a key:value pair must be a ternary expression
  • condition of that expression must have array access operator (foo[bar])
  • "true" value of the ternary must be a template string
  • the template string must contain an interpolated bit
    once that happens the template string is considered not closed and treats all following code as part of it. my experiments point to a theory that the "true" value is somehow treated as another key for the object, instead of an expression (included in the example files).

attaching both a file where i analyse and deconstruct the problem, as well as a screenshot with how it looks on my machine:

ts-syntax-bug.txt
ts-syntax-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions