0

Babel とデコレータで遊んでいます。例えば:

function test(target) { 
}

@test
class A {}

私の懸念は、クラスに対してデコレーターを使用し、いわゆるデコレーターに引数を与えることができ、コンストラクター関数を最初の引数として取得する機会を失わない方法があるかどうかです。

function test(target, arg1, argN) {
   // target will be "hello", arg1 will be "world" and argN undefined,
   // while I would expect target to be the constructor function
}

@test("hello", "world")
class A {}
4

1 に答える 1