Webstorm + Flow + React: Unresolved variable or type $Keys

Multi tool use
Multi tool use


Webstorm + Flow + React: Unresolved variable or type $Keys



I'm trying to follow the docs for declaring an enum in flow. The docs say to use one of these utility classes:
Flow Utility classes: flow.org/en/docs/types/utilities



When I follow the pattern listed in the docs:


// @flow
const countries = {
US: "United States",
IT: "Italy",
FR: "France"
};

type Country = $Keys<typeof countries>;

const italy: Country = 'IT';
const nope: Country = 'nope'; // 'nope' is not a Country



Webstorm complains that $Keys is an unresolved variable or type.



Testing further, it also does this with $Values, $ReadOnly, and any of the other utility types.



My stack is CRA+Redux+Flow.



Stuff I've tried:



I've searched around in circles with no answer. I found one source saying "install flow globally instead", I tried that, but it didn't work.



Looking for ways to do an enum without a utility class: I'm sure there's a way, but I've not found it yet



Flow is set as the Javascript type on webstorm



Turning it off and back on



picture:
Demonstrating the error





Please make sure that you are familiar with this article: blog.jetbrains.com/webstorm/2016/11/using-flow-in-webstorm
– falinsky
Jul 3 at 6:34





I already am. "Flow is set as the Javascript type on webstorm"
– Jefferson
Jul 3 at 7:41





Is there any errors or warnings webstorm highlights to you (I mean not about the code you're editing, but the app itself)?
– falinsky
Jul 3 at 7:53



webstorm





nope, I checked webstorm's event log and all is ok. The variables are just not being seen in the global scope at all.
– Jefferson
Jul 3 at 8:32





I have the same issue in webstorm. Found intellij-support.jetbrains.com/hc/en-us/community/posts/… but it seems not to be so hepful
– falinsky
Jul 4 at 7:41









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

MJZynWIiNLSfA1sEu,bo,AB Jb96c p1X,YjuY,uJhX1pYhtTKpQoi JriqshtCoHdwfSrHFYWKoZVHYlbBlqSEkz3fKg5pAeJKZIK W
c158NA 81xp84d,JDpE

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications