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

Implement object type spread (both $Exact and nonexact semantics) #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

rosskevin
Copy link

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.

@@ -194,9 +225,9 @@ converters.GenericTypeAnnotation = (path: Path, opts: Options) => {
if (typeParametersConverters[name]) {
return typeParametersConverters[name](path, opts);
} else {
throw error(
debugger;throw error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debugger

`,
},

{
Copy link
Contributor

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?

@@ -50,10 +49,15 @@ function typeToValue(node) {
return t.valueToNode(value);
}

function isExact(path: Path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about {| ... |}?

Copy link
Author

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?

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosskevin
Copy link
Author

rosskevin commented Jun 12, 2017

Changes made on this and #2.

@rosskevin
Copy link
Author

Trying to get this rebased, but error stack trace line numbers no longer line up...so it's a bit of a pain.

@rosskevin
Copy link
Author

@thejameskyle this is rebased and good to go.

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