Allow TSInterfaceDeclaration to be default export (#8408)
<!-- Before making a PR, please read our contributing guidelines https://github.com/babel/babel/blob/master/CONTRIBUTING.md For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly) If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website --> | Q | A <!--(Can use an emoji 👍) --> | ------------------------ | --- | Fixed Issues? | Fixes #7118 | Patch: Bug Fix? | Y | Major: Breaking Change? | N | Minor: New Feature? | N | Tests Added + Pass? | Yes | Documentation PR Link | | Any Dependency Changes? | | License | MIT
This commit is contained in:
@@ -1535,6 +1535,17 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
cls.abstract = true;
|
||||
return cls;
|
||||
}
|
||||
|
||||
// export default interface allowed in:
|
||||
// https://github.com/Microsoft/TypeScript/pull/16040
|
||||
if (this.state.value === "interface") {
|
||||
return this.tsParseDeclaration(
|
||||
this.startNode(),
|
||||
this.state.value,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
return super.parseExportDefaultExpression();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user