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

Add support for object type spread #5525

Merged
merged 2 commits into from Apr 20, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -331,6 +331,11 @@ export function ObjectTypeProperty(node: Object) {
this.print(node.value, node);
}

export function ObjectTypeSpreadProperty(node: Object) {
this.token("...");
this.print(node.argument, node);
}

export function QualifiedTypeIdentifier(node: Object) {
this.print(node.qualification, node);
this.token(".");
@@ -0,0 +1,7 @@
type U = {};
type V = {};
type T = { ...U, };
type T = { ...U, ...V };
type T = { p: V, ...U };
type T = { ...U, p: V, };
type T = { ...{}|{ p: V, }};
@@ -0,0 +1,7 @@
type U = {};
type V = {};
type T = { ...U };
type T = { ...U, ...V, };
type T = { p: V, ...U, };
type T = { ...U, p: V, };
type T = { ...{} | { p: V } };
@@ -44,6 +44,7 @@ var a: { subObj: {strVal: string} }
var a: { subObj: ?{strVal: string} }
var a: { param1: number; param2: string }
var a: { param1: number; param2?: string }
var a: { ...any; ...{}|{p: void} };
var a: { [a: number]: string; [b: number]: string; };
var a: { add(x: number, ...y: Array<string>): void };
var a: { id<T>(x: T): T; };
@@ -47,6 +47,7 @@ var a;
var a;
var a;
var a;
var a;
var a = [1, 2, 3];
a = class Foo {};
a = class Foo extends Bar {};
@@ -308,6 +308,14 @@ defineType("ObjectTypeProperty", {
},
});

defineType("ObjectTypeSpreadProperty", {
visitor: ["argument"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
// todo
},
});

defineType("QualifiedTypeIdentifier", {
visitor: ["id", "qualification"],
aliases: ["Flow"],
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.