facebook / facebook/flow

intersection types behaving unexpectedly when used inside types vs classes

未關閉
#2,547 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Typing: unions/intersections
主要語言
Rust
星號
22.3k
分支
1.9k
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。