From 6f5e47eff07225f4a95de23b13494729ab42aa26 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 16 Apr 2016 18:27:55 -0400 Subject: [PATCH] Check if `t.is` is already defined (specifically accounting for the isImmutable method in validators --- packages/babel-types/src/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index 911fba5cdb..5a4b581112 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -12,9 +12,12 @@ let t = exports; */ function registerType(type: string) { - let is = t[`is${type}`] = function (node, opts) { - return t.is(type, node, opts); - }; + let is = t[`is${type}`]; + if (!is) { + is = t[`is${type}`] = function (node, opts) { + return t.is(type, node, opts); + }; + } t[`assert${type}`] = function (node, opts) { opts = opts || {};