Looks like the magic for immutable
happens in their custom addon to the transpiler here.
They're basically creating their own createClass
which skips the check. This is a snippet from the transpiled (via babel
) version of my code above.
var Foo = (function (_List) {
_inherits(Foo, _List);
function Foo() {
_classCallCheck(this, Board);
_get(Object.getPrototypeOf(Foo.prototype), 'constructor', this).apply(this, arguments);
}
return Foo;
})(_immutable.List);
Where _classCallCheck
looks like this.
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
For immutable
, it seems the ES6 code is first transformed to already include the createClass
calls.