generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
My concern with using void for this purpose in pattern matching, e.g. this example:
match (obj) {
{x: void, y: void, ...rest}: ...
}
Is that in this context, I believe a reasonable interpretation (and perhaps one that comes to mind first for those not familiar with this feature) would be that we are matching for objects that do not have the properties x and y (or that they are undefined), given that it looks like we are "matching against void", rather than the properties x and y exist and can be any unknown value. This is because the void operator returns undefined, and type-systems like TypeScript and Flow use void as a type for either undefined or the lack of a value (i.e. void return).
I hope we can use _, even if only in the context of new syntax like extractors or match
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels