Add export interface Flow syntax support
An interface export is just like a type export. In fact, it's a syntax affordance which makes the following equivalent:
```javascript
interface I_ { ... }
export type I = I_;
```
```javascript
export interface I { ... }
```
See facebook/flow#1145
This commit is contained in:
@@ -687,7 +687,9 @@ export default function (instance) {
|
||||
// export type
|
||||
instance.extend("shouldParseExportDeclaration", function (inner) {
|
||||
return function () {
|
||||
return this.isContextual("type") || inner.call(this);
|
||||
return this.isContextual("type")
|
||||
|| this.isContextual("interface")
|
||||
|| inner.call(this);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -745,6 +747,11 @@ export default function (instance) {
|
||||
// export type Foo = Bar;
|
||||
return this.flowParseTypeAlias(declarationNode);
|
||||
}
|
||||
} else if (this.isContextual("interface")) {
|
||||
node.exportKind = "type";
|
||||
let declarationNode = this.startNode();
|
||||
this.next();
|
||||
return this.flowParseInterface(declarationNode);
|
||||
} else {
|
||||
return inner.call(this, node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user