Closed ronzeidman closed 8 years ago
This sounds quite strange, are you able to provide a repro?
@ronzeidman @frankwallis it's impossible to decorate interfaces or there properties because they have no runtime representation. This should actually produce a compilation error. If you're trying to use dependency injection systems that rely on decorator metadata to inject implementations of services you need to use classes.
Properties with interface types can be decorated in classes they are written in typescript. There's no way to import interfaces into a Javascript file. Make sure the version of typescript used by plugin-typescript and the version you are using in your IDE or from the command line is the same version.
@aluanhaddad I'm not using interfaces for dependency injection, I'm using them just to signify input variables in angular 2 which should be supported:
@Input() myVar: IMyInterface;
This decorator should use "Object" type instead of the interface type since the code of the decorator doesn't actually use the type, "Object" type is sufficient. I'm pretty sure I'm using the same devDependency of typescript in both cases. I'll try to create a simple reproduction and post it here. Sorry for the delay.
In the latest version it works as expected. Sorry for the trouble.
this is how the plugin decorated my component:
this is how tsc decorated the component:
I have two issues with the first approach: 1) I cannot import typescript interfaces in js and work with them 2) the type interface is from a "contract only" "d.ts" file, and it tried to require it. obviously it didn't work.
Since I use decorators on interface type properties I cannot use this plugin at all.
Thanks for the hard work!