Created
November 7, 2017 20:40
-
-
Save dmueller39/1b8b9a95e75da0797f96121d5d8e0926 to your computer and use it in GitHub Desktop.
Demonstration of bug where Flow can not decide which case to select when constant is defined in a different file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
export const Foo:'foo' = 'foo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { Foo } from './constants'; | |
type Action = { type: typeof Foo, config: { } } | { type: 'bar'}; | |
/* expect error | |
object literal | |
Could not decide which case to select | |
union type | |
... | |
*/ | |
const action: Action = { type: Foo, config: { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
export const Foo:'foo' = 'foo'; | |
type Action = { type: typeof Foo, config: { } } | { type: 'bar'}; | |
/* works fine */ | |
const action: Action = { type: Foo, config: { } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment