TypeScriptのdecorator
仕様の変遷
種類
decoratorは通常の高階関数として定義できる
逆に言えば、ただの関数宣言だけ見れば、それがdecoratorして使用される関数なのかどうかは判断できない

このように定義すると、
tsfunction color(value: string) {
return function (target) {
// ..
};
}
こう使える
tsclass C {
@color()
method() {..}
}
これ、常に必要になるわけじゃないんか

ユースケース
ログ出力
確かにコレ良さそう

method内に直接ログを書くんじゃなくて、decoratorを付与してログを出力できる
method内は、そのmethodに関する処理だけに集中できる
引数のvalidaiton
notEmptyStringかとか、Intかなどのvalidationができる
DI
classにしか使えないの?関数に対しては使えないの?なんで?
tscofig