don't rely on scope to get the type alias

This commit is contained in:
Amjad Masad
2016-03-10 12:13:05 -08:00
parent 342f9d5eb5
commit fd7b1c3386

View File

@@ -89,14 +89,8 @@ suite("api", function () {
new Plugin({
visitor: {
Function: function(path) {
var node = path.node;
var scope = path.scope;
var alias = scope
.getProgramParent()
.getBinding(node.returnType.typeAnnotation.id.name)
.path
.node;
var alias = path.scope.getProgramParent().path.get('body')[0].node;
if (!babel.types.isTypeAlias(alias)) return;
// In case of `passPerPreset` being `false`, the
// alias node is already removed by Flow plugin.