-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
$Values not working properly #4411
Comments
In your example |
I guess I misunderstood the purpose of $Values, is its expected behaviour not as described in this issue? |
Values doesn't seem to be the issue here, if you change your example from... /* @flow */
const CHANGE_LOCATION = 'app/page/CHANGE_LOCATION'
const valueHolder = { CHANGE_LOCATION }
type TYPE_CHANGE_LOCATION = $Values<typeof valueHolder>
const x: TYPE_CHANGE_LOCATION = 'x' to /* @flow */
const CHANGE_LOCATION:'app/page/CHANGE_LOCATION' = 'app/page/CHANGE_LOCATION'
const valueHolder = { CHANGE_LOCATION }
type TYPE_CHANGE_LOCATION = $Values<typeof valueHolder>
const x: TYPE_CHANGE_LOCATION = 'x' You'll get the expected error,
The real question here is: Should flow be making the string literal assignment the type of the string (if I've phrased that correctly)? |
Going over changelog for 0.50.0,
$Values
is implemented. However, both on my local machine (flow version
reports 0.50.0) and onmaster
on flow.org/try $Values does not report errors when a variable typed with $Values of an object do not match any of themThe text was updated successfully, but these errors were encountered: