TS: Support ? for method declarations in interfaces #37

Closed
opened 2024-10-08 15:21:42 +02:00 by SirPepe · 3 comments
SirPepe commented 2024-10-08 15:21:42 +02:00 (Migrated from github.com)

The grammar does not appear to understand the foo?(): number; bit of the following:

interface Test { foo?(): number; }

declare var t: Test;

t.foo() // Cannot invoke an object which is possibly 'undefined'

https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgCoQM5mQb2TAewIH4AKASgC5kQBXAWwCNoBuZAXwChOATCBADZwoKAG7DkYauiwtuYAHSECFZAHo1yAMJwQIAtlCiCAaxS7kBRgCt+2AO4ALYAkfJgGZAAcCGDMEYBAE9kAHJaED4YUAgeUKA

The grammar does not appear to understand the `foo?(): number;` bit of the following: ``` interface Test { foo?(): number; } declare var t: Test; t.foo() // Cannot invoke an object which is possibly 'undefined' ``` https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgCoQM5mQb2TAewIH4AKASgC5kQBXAWwCNoBuZAXwChOATCBADZwoKAG7DkYauiwtuYAHSECFZAHo1yAMJwQIAtlCiCAaxS7kBRgCt+2AO4ALYAkfJgGZAAcCGDMEYBAE9kAHJaED4YUAgeUKA
marijnh commented 2024-10-08 16:18:47 +02:00 (Migrated from github.com)

Implemented in attached patch. Got any more of these coming or shall I cut a release?

Implemented in attached patch. Got any more of these coming or shall I cut a release?
SirPepe commented 2024-10-08 17:22:59 +02:00 (Migrated from github.com)

That's all, at least for the next few days! Thank you.

That's all, at least for the next few days! Thank you.
marijnh commented 2024-10-08 17:41:14 +02:00 (Migrated from github.com)

Tagged 1.4.19

Tagged 1.4.19
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#37
No description provided.