Closed
Description
When writing a library that relies heavily on decorators in typescript, it would be beneficial if decorator information could be somehow preserved in the generated *.d.t.s file. I don't have any suggestion how it could be done except for maybe just code comments containing the original decorator.
Currently code like this
module feather.ui {
import Construct = feather.annotations.Construct
import Widget = feather.core.Widget
import deepValue = feather.objects.deepValue
import TypedMap = feather.types.TypedMap
@Construct({selector: 'localization', singleton: true, attributes: ['translations']})
export class Localization extends Widget {
translations: TypedMap<any> = {}
constructor(translations: TypedMap<any>) {
super()
this.translations = translations
}
translate = (key: string) =>
deepValue(this.translations, key) || key
}
}
could generate this:
declare module feather.ui {
import Widget = feather.core.Widget;
import TypedMap = feather.types.TypedMap;
/* @Construct({selector: 'localization', singleton: true, attributes: ['translations']}) */
class Localization extends Widget {
translations: TypedMap<any>;
constructor(translations: TypedMap<any>);
translate: (key: string) => any;
}
}
Since I'm writing a IDE plugin, I could read that comment to help me with looking up methods that satisfy particular criteria in a published library.