fix(typescript): erase default export if exporting a TS type (#10019)
This commit is contained in:
parent
9dd8825eff
commit
a6392bd636
@ -156,6 +156,16 @@ export default declare((api, { jsxPragma = "React" }) => {
|
||||
}
|
||||
},
|
||||
|
||||
ExportDefaultDeclaration(path, { exportableTSNames }) {
|
||||
// remove whole declaration if it's exporting a TS type
|
||||
if (
|
||||
t.isIdentifier(path.node.declaration) &&
|
||||
exportableTSNames.has(path.node.declaration.name)
|
||||
) {
|
||||
path.remove();
|
||||
}
|
||||
},
|
||||
|
||||
TSDeclareFunction(path) {
|
||||
path.remove();
|
||||
},
|
||||
|
||||
@ -42,6 +42,7 @@ function foo() {}
|
||||
export { II3 as default, AA2 as A, BB2 as BB3, foo }; // only BB2 and foo
|
||||
|
||||
// export an interface before declaration
|
||||
export default Bar;
|
||||
export { Bar } // everything removed
|
||||
export { Bar as Bar2, C2 as C4 } // only C4
|
||||
interface Bar {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user