diff --git a/src/babel/types/index.js b/src/babel/types/index.js index 30d510508b..78738609ac 100644 --- a/src/babel/types/index.js +++ b/src/babel/types/index.js @@ -267,9 +267,11 @@ export function removeComments(child: Object): Object { */ export function inheritsComments(child: Object, parent: Object): Object { - each(COMMENT_KEYS, function (key) { - child[key] = uniq(compact([].concat(child[key], parent[key]))); - }); + if (child && parent) { + each(COMMENT_KEYS, function (key) { + child[key] = uniq(compact([].concat(child[key], parent[key]))); + }); + } return child; }