mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix crash when exporting type of existing variable
Summary:
When using flow syntax like this, the parser would throw an error.
```
const foo = new ClassInstance();
export type {foo};
```
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D39850098
fbshipit-source-id: 28a7748892559c2c4a0fb8afa8612cbeb5568058
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b9e9e852a6
commit
b9a03ce197
+3
-2
@@ -26,8 +26,9 @@ function getTypes(ast: $FlowFixMe): TypeDeclarationMap {
|
||||
return ast.body.reduce((types, node) => {
|
||||
if (node.type === 'ExportNamedDeclaration' && node.exportKind === 'type') {
|
||||
if (
|
||||
node.declaration.type === 'TypeAlias' ||
|
||||
node.declaration.type === 'InterfaceDeclaration'
|
||||
node.declaration != null &&
|
||||
(node.declaration.type === 'TypeAlias' ||
|
||||
node.declaration.type === 'InterfaceDeclaration')
|
||||
) {
|
||||
types[node.declaration.id.name] = node.declaration;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user