Skip to content

Instantly share code, notes, and snippets.

@dmueller39
Created November 7, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmueller39/1b8b9a95e75da0797f96121d5d8e0926 to your computer and use it in GitHub Desktop.
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
// @flow
export const Foo:'foo' = 'foo';
// @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: { } }
// @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