codemix / babel-plugin-typecheck

Static and runtime type checking for JavaScript in the form of a Babel plugin.
MIT License
886 stars 44 forks source link

Fix React propTypes in combination with decorators #132

Closed ntkoopman closed 8 years ago

ntkoopman commented 8 years ago

When using a decorator that introduces a higher order class, the propTypes where assigned to the wrong class.

I did not include a unit test for this, as decorators currently require a non-standard transformation to work. I can add one if this is not a problem.

This patch assumes that you have the class properties transformation enabled if you have are using decorators (because there is no simple way to assign things to the prototype of the decorated class without them).

phpnode commented 8 years ago

@ntkoopman looks like something odd is going on with the tests, might be unrelated to your work. I'm happy to include the decorators plugin as a dependency if it means we can test this kind of issue.

ntkoopman commented 8 years ago

I've add a unit test

phpnode commented 8 years ago

@ntkoopman thanks!