jayphelps / core-decorators

Library of stage-0 JavaScript decorators (aka ES2016/ES7 decorators but not accurate) inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more. Popular with React/Angular, but is framework agnostic.
MIT License
4.51k stars 263 forks source link

Typescript generates enumerable methods #136

Open BurtHarris opened 7 years ago

BurtHarris commented 7 years ago

@jayphelps it seems that Typescript is generating methods (in classes) with the enumerable property set to true. I've found an issue tracking this as a bug Microsoft/TypeScript#15308, it but there seem to be older related issues and I'm guessing it isn't currently a high priority.

This is causing some tests of this projects to fail. I had misinterpreted it earlier as being related to the property descriptor limitation, but this seems to be separate. For some decorators (e.g. autobind) it would be simple for us to change the returned descriptor to make the test pass, do you think that's a good idea, or should we do something to the tests?

BurtHarris commented 7 years ago

 1) @autobind (from TypeScript) sets the correct prototype descriptor options:

      enumerable property mismatch
      + expected - actual

      -true
      +false

      at Context.<anonymous> (test\typescript\autobind.spec.ts:75:28)

  4) @decorate (from TypeScript) sets the correct prototype descriptor options:

      enumerable
      + expected - actual

      -true
      +false

      at Context.<anonymous> (test\typescript\decorate.spec.ts:55:28)
jayphelps commented 7 years ago

Hmm did you link to the right issue? https://github.com/Microsoft/TypeScript/pull/15308 ? It's not clear how it relates 😄