GithubHelp home page GithubHelp logo

Comments (5)

loganfsmyth avatar loganfsmyth commented on September 26, 2024

Probably another case of #24 where your plugins are in the wrong order?

from babel-plugin-transform-decorators-legacy.

goto100 avatar goto100 commented on September 26, 2024

Seems not. I'm not using transform-class-properties, my .babelrc file is:

{
  "plugins": [
    "transform-decorators-legacy",
    "add-module-exports",
    "transform-es2015-classes",
    "transform-es2015-destructuring",
    "transform-es2015-function-name",
    "transform-es2015-parameters",
    "transform-es2015-sticky-regex",
    "transform-es2015-unicode-regex",
    "transform-es2015-modules-commonjs"
  ]
}

from babel-plugin-transform-decorators-legacy.

goto100 avatar goto100 commented on September 26, 2024

If I add use strict in the head of the test file, I can even use just one single plugin, the problem still happens.

'use strict';

function classDecorator(Target) {
  return class DecoratedClass extends Target {
    test() {
      return 'decorated';
    }
  };
}

@classDecorator
class Test {
  static test() {
    return 'original';
  }

  static run() {
    // `Test` is not the *decorated* class here, but it is in bebel 5.
    console.log(Test.test());
  }
}

Test.run();

.babelrc

{
  "plugins": [
    "transform-decorators-legacy"
  ]
}

from babel-plugin-transform-decorators-legacy.

loganfsmyth avatar loganfsmyth commented on September 26, 2024

Ugh, I'm sorry, I misread your issue. This is actually a duplicate of #16, not the one I linked to.

The spec currently is just desugaring examples, which supports the current behavior, rather than the Babel 5 behavior, since it says

@dec
class Foo {
}

should behave like

let Foo = (function () {
  class Foo {
  }

  Foo = dec(Foo) || Foo;
  return Foo;
})();

from babel-plugin-transform-decorators-legacy.

goto100 avatar goto100 commented on September 26, 2024

Sorry for the mistake, the code in this case works fine. So I opened another issue #29, that's the actually problem.

from babel-plugin-transform-decorators-legacy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.