TS: "<" missing when parsing generic arrow functions #43

Closed
opened 2024-12-03 12:39:23 +01:00 by SirPepe · 2 comments
SirPepe commented 2024-12-03 12:39:23 +01:00 (Migrated from github.com)

type identity<T> = T; turns into the following:

Script(TypeAliasDeclaration(type,TypeDefinition,TypeParamList("<",TypeDefinition,">"),Equals,TypeName,";"))

This includes the < character.

const identity = <T> (x: T): T => x; turns into the following:

Script(VariableDeclaration(const,VariableDefinition,Equals,ArrowFunction(TypeParamList(TypeDefinition,">"),ParamList("(",VariableDefinition,TypeAnnotation(":",TypeName),")"),TypeAnnotation(":",TypeName),Arrow,VariableName),";"))

Looks like the < token has gone AWOL?

`type identity<T> = T;` turns into the following: ``` Script(TypeAliasDeclaration(type,TypeDefinition,TypeParamList("<",TypeDefinition,">"),Equals,TypeName,";")) ``` This includes the `<` character. `const identity = <T> (x: T): T => x;` turns into the following: ``` Script(VariableDeclaration(const,VariableDefinition,Equals,ArrowFunction(TypeParamList(TypeDefinition,">"),ParamList("(",VariableDefinition,TypeAnnotation(":",TypeName),")"),TypeAnnotation(":",TypeName),Arrow,VariableName),";")) ``` Looks like the `<` token has gone AWOL?
marijnh commented 2024-12-03 13:01:18 +01:00 (Migrated from github.com)

The token was missing a name. Attached patch adds it.

Let me know when you think you're done reporting these --- I'll cut another release.

The token was missing a name. Attached patch adds it. Let me know when you think you're done reporting these --- I'll cut another release.
SirPepe commented 2024-12-03 14:03:31 +01:00 (Migrated from github.com)

Done for today, thank you :)

Done for today, thank you :)
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#43
No description provided.