facebook / facebook/flow

Weird grammar with function types and intersections

Open
#3,256 0 comments 0 reactions 0 assignees View on GitHub
parsing
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

For some reason:

`=>` binds tighter than `&` when `&` comes first

```js
type A = boolean & number => void;
declare function a((boolean & number)): void;

(a: A); // ERROR
```

but `&` binds tighter than `=>` when `=>` comes first?

```js
type B = void => boolean & number;
declare function b(void): (boolean & number);

(b: B); // WORKS
```

It seems like it should be more consistent on both sides.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.