Skip to content

Improve the type of TemplateExpression #145

Description

@bakkot

TemplateExpression has

interface TemplateExpression : Expression {
  attribute Expression? tag;
  attribute (Expression or TemplateElement)[] elements;
}

but that's imprecise: the elements must alternate, be nonempty, and begin and end with TemplateElement. A better type would be

interface TemplatePart {
  attribute Expression expression;
  attribute TemplateElement string;
}
interface TemplateExpression : Expression {
  attribute Expression? tag;
  attribute TemplateElement first;
  attribute TemplatePart[] parts;
}

which represents precisely the legal templates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions