The magic for immutable seems to be happening in its custom transporter addon here .
They basically create their own createClass , which skips the check. This is a snippet from the forwarded (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 as follows.
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
For immutable it seems that ES6 code is first converted to already include createClass calls.
source share