Old assertion syntax with "const" results in parse error #46

Closed
opened 2025-07-15 14:42:26 +02:00 by SirPepe · 1 comment
SirPepe commented 2025-07-15 14:42:26 +02:00 (Migrated from github.com)

This a valid syntax for const assertions:

const x = <const>[1, 2];

Lezer does not agree:

Script(VariableDeclaration(const,VariableDefinition,Equals,MemberExpression(ArrowFunction(TypeParamList("<",const,⚠,">"),⚠),"[",SequenceExpression(Number,",",Number),"]"),";"))
This a [valid](https://www.typescriptlang.org/play/?jsx=0#code/MYewdgzgLgBAHjAvDAPKSUB8BtAjAGhgCYBdAbiA) syntax for const assertions: ```typescript const x = <const>[1, 2]; ``` Lezer does not agree: ``` Script(VariableDeclaration(const,VariableDefinition,Equals,MemberExpression(ArrowFunction(TypeParamList("<",const,⚠,">"),⚠),"[",SequenceExpression(Number,",",Number),"]"),";")) ```
marijnh commented 2025-07-15 14:46:34 +02:00 (Migrated from github.com)

Attached patch adds support for that.

Attached patch adds support for that.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/javascript#46
No description provided.