Add support for "declare interface" Flow syntax

This has been a feature in Flow for a long time (couldn't easily find a
specific commit adding this). Interfaces are basically undocumented, though, so
it's easy to see how this was missed.
This commit is contained in:
Sam Goldman
2016-01-04 11:50:12 -08:00
parent 0980819346
commit bd5c1a5b1b
3 changed files with 293 additions and 0 deletions

View File

@@ -60,6 +60,8 @@ pp.flowParseDeclare = function (node) {
return this.flowParseDeclareModule(node);
} else if (this.isContextual("type")) {
return this.flowParseDeclareTypeAlias(node);
} else if (this.isContextual("interface")) {
return this.flowParseDeclareInterface(node);
} else {
this.unexpected();
}
@@ -104,6 +106,12 @@ pp.flowParseDeclareTypeAlias = function (node) {
return this.finishNode(node, "DeclareTypeAlias");
};
pp.flowParseDeclareInterface = function (node) {
this.next();
this.flowParseInterfaceish(node);
return this.finishNode(node, "DeclareInterface");
}
// Interfaces