Last active
November 1, 2017 03:31
-
-
Save apiv/8083676e2335f456e19b34d06e60d5d9 to your computer and use it in GitHub Desktop.
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 | |
type Options = { | |
getId: (passedProps: {}) => string | string[] | |
} | |
const Entities = (options: Options) => /* ...code ... */ | |
Entities({ getId: ({ contactId }) => Immutable.List([contactId]) }) | |
// => throws a compiler error, return type of getId must be string | string[] | |
Entities({ getId: ({ contactId }) => contactId && [contactId] }) | |
// => throws a compiler error, contactId might be undefined, since it is not typed | |
Entities({ getId: ({ contactId }) => [contactId] }) | |
// => all good, compiler compiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment