-
Notifications
You must be signed in to change notification settings - Fork 11
Implement object type spread (both $Exact and nonexact semantics) #1
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
base: master
Are you sure you want to change the base?
Conversation
src/convertTypeToPropTypes.js
Outdated
return typeParametersConverters[name](path, opts); | ||
} else { | ||
throw error( | ||
debugger;throw error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugger
src/__tests__/classes.test.js
Outdated
} | ||
`, | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests for context types?
return t.valueToNode(value); | ||
} | ||
|
||
function isExact(path: Path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about {| ... |}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that shorthand for exact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it should be preferred over $Exact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made on this and #2. |
…ntics and fix flow errors
48d149f
to
673d2c2
Compare
Trying to get this rebased, but error stack trace line numbers no longer line up...so it's a bit of a pain. |
@thejameskyle this is rebased and good to go. |
Object type spread was introduced in Flow 0.42.0
Documentation is not yet published, but the behavior is documented here and this is referenced in the implementation, as use without
$Exact
is odd - it makes all prop values from the spread optional.I have mirrored flow behavior, though I expect the default behavior may change. This too is commented in code so we have some sanity to check and change it in the future.