facebook / facebook/flow

intersection types behaving unexpectedly when used inside types vs classes

Đang mở
#2,547 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
Typing: unions/intersections
Ngôn ngữ chính
Rust
Star
22.3k
Fork
1.9k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

consider [this example](https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCCYAvGAN5hRxwBcYAzhgE4CWAdgOZgC+A3JlwEAQqQpgARgENm9Jmy68Bg-GAAqeALY4YUjHgA8awgBp1wgHxjyqMGAAe9ABRT6xsADJzASlJWAbnCsACYmtmBYzq7qhL4kAUGhqDzoAMa6DAxgAEp47MF4zIVGpuZWNnb62rr6blo6eobGZmqWAnbhqXDs8gCuqRhwzE5VDbXq9TVNpa0WvhVgAJAYABasDAB0o1Ni243tvMlp3UxgGHXVjQalltbhjmBOlNRwZtLMvHHlPGF2kY-PGifPwUH7JZTsPBIXL5QqFEbePhAA) vs [this one](https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCCYAvGAN5hRxwBcYAzhgE4CWAdgOZgC+A3JlwEAQqQpgARgENm9Jmy68BqAMYwpDBmAAqeALY51GPAB5tARgA0OgEwA+CqjBgAHvQAUU+hbAAyWwCUpA4AbnCsACYCzlgeXjrmQSSh4VFOYOkqcOzyAK4qGHDM7pQu1li8QeTpzhgAFqwMAHQuYi7RzmD1jU0VZFgdPKhDquqaYABKeOwReMxzZla2DtW1+oZSxt7rRqYW1tr2HZnZeQVF7sYGu9vXm3tLh3ZV6QCQ3c1XG8ZiX7uDw3QWRyGC6t2+pkI1mEDjI7DwSF0d2MJXSbjAJSoNGs0mYlWCFB4lnSsQxlGocHxyUJxJ4AWU8KQUxmczml3pQA)

The only thing changing between the two is that in the first case I use `type` and in the second I use `class`. For some reason the intersection inside the type throws an error. The same intersection inside a class (or even an interface) doesn't throw. I believe this is a bug

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.