allow class/function expressions in tags (#18324)

We shouldn't error on encountering `class` and `function`, because they
are treated as expressions rather than declarations
pull/18315/head
Rich Harris 3 months ago committed by GitHub
parent 6a955758a6
commit 6d26dce265
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -14,8 +14,7 @@ const regex_whitespace_with_closing_curly_brace = /\s*}/y;
const regex_supported_declaration = /(?:let|const)\b/y;
// All except `type` are reserved keywords and cannot be used as variable names.
// For type we check if it's not something like `type .x` / `type ()` / `type % 2` / ...
const regex_unsupported_declaration =
/(?:(?:var|function|class|interface|enum)\b)|(?:type\s+[^?.(`<[&|%^}])/y;
const regex_unsupported_declaration = /(?:(?:var|interface|enum)\b)|(?:type\s+[^?.(`<[&|%^}])/y;
const pointy_bois = { '<': '>' };

@ -1,14 +1 @@
[
{
"code": "declaration_tag_invalid_type",
"message": "Declaration tags must be `let` or `const` declarations",
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 10
}
}
]
[]

Loading…
Cancel
Save