Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

Unable to use Object.values() with Flow #1

Closed
rishabh-ink opened this issue Jun 2, 2019 · 0 comments
Closed

Unable to use Object.values() with Flow #1

rishabh-ink opened this issue Jun 2, 2019 · 0 comments

Comments

@rishabh-ink
Copy link
Contributor

Flow does not allow using…

const lightLevelsArray = Object.values(lightLevels);

… because of facebook/flow #2221 "When using Object as maps, Object.values treats values as mixed".

Thus, the values need to be repeated as…

const lightLevelArray = ['normal', 'dim', 'washed'];

… even though we’ve defined a frozen Object

export const availableLightLevels: {|
  NORMAL: string,
  DIM: string,
  WASHED: string,
|} = Object.freeze({
  NORMAL: 'normal',
  DIM: 'dim',
  WASHED: 'washed',
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant