Check if t.is is already defined (specifically accounting for the isImmutable method in validators
This commit is contained in:
parent
c9e5da6ad0
commit
6f5e47eff0
@ -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 || {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user