Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exact empty object not working #4681

Closed
villesau opened this issue Aug 22, 2017 · 1 comment
Closed

exact empty object not working #4681

villesau opened this issue Aug 22, 2017 · 1 comment

Comments

@villesau
Copy link
Contributor

following code fails:

/* @flow */

type Empty = {||};
const huh = (ob: Empty) => ob;
huh({});

to this:

5: huh({});
       ^ object literal. Inexact type is incompatible with exact type
4: const huh = (ob: Empty) => ob;
                    ^ exact type: object type

see: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCiAtjtmALxgDeAPrQL4DcqAxnAHYDOGYAFgFc+lMAAo4AIwBcRUtgCUlAHxhJLQX1HUG8pkA

when following works just fine:

/* @flow */

type NotEmpty = {|lol: number|};
const huh = (ob: NotEmpty) => ob;
huh({lol: 1});

see: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgBycGAogLY7ZgC8YA3gD7wwBcYAdgK7kBGeAJ0YBfANyoAxnA4BnDGAAWXBbTAAKOL3bEylbAEpaAPjCbxShWvot2ARmH7RQA

@jcready
Copy link
Contributor

jcready commented Aug 22, 2017

Duplicate of #4582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants