Add support for "declare type" Flow syntax

See facebook/flow#1105
This commit is contained in:
Sam Goldman
2016-01-04 11:37:59 -08:00
parent 2516b7570f
commit e764346d5f
10 changed files with 275 additions and 0 deletions

View File

@@ -58,6 +58,8 @@ pp.flowParseDeclare = function (node) {
return this.flowParseDeclareVariable(node);
} else if (this.isContextual("module")) {
return this.flowParseDeclareModule(node);
} else if (this.isContextual("type")) {
return this.flowParseDeclareTypeAlias(node);
} else {
this.unexpected();
}
@@ -96,6 +98,12 @@ pp.flowParseDeclareModule = function (node) {
return this.finishNode(node, "DeclareModule");
};
pp.flowParseDeclareTypeAlias = function (node) {
this.next();
this.flowParseTypeAlias(node);
return this.finishNode(node, "DeclareTypeAlias");
};
// Interfaces