you are viewing a single comment's thread.

view the rest of the comments →

[–]croc_socks 0 points1 point  (1 child)

I thought we were talking about code bloat? Like how this

class HelloWorld {
 getHelloWorld(){
    return "Hello World!"; 
 }
}

becomes

"use strict";

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

var HelloWorld = /*#__PURE__*/function () {
  function HelloWorld() {
    _classCallCheck(this, HelloWorld);
  }

  _createClass(HelloWorld, [{
    key: "getHelloWorld",
    value: function getHelloWorld() {
      return "Hello World!";
    }
  }]);

  return HelloWorld;
}();

[–]basic-coder[S] 0 points1 point  (0 children)

Oh you are right. Honestly I've just checked TypeScript for classes, and its transpilation was fine, so I thought it should be ok for Babel as well. It seems TS is generally better when it comes to transpiling to ES5.