0
필자는 typescript와 ES7로 데코레이터에 대해 더 많이 읽었습니다. 이것은 내가 콘솔에서 무엇을 얻을2 개의 인수를 속이는 Typescript 데코레이터, 이것을 컴파일하는 방법은 무엇입니까?
function decorator(...args) {
console.log(args);
}
//@decorator
class foo {
constructor() {}
@decorator
method() {}
}
let bar = new foo();
bar.method();
:
$ npm install -g [email protected]
$ npm install -g @types/node
$ tsc --experimentalDecorators file.ts
$ node file.js
[ foo { method: [Function] }, 'method' ]
만 두 개의 인수 그리고 나는이 간단한 코드를 시도했다. I는 타이프 운동장에서 이것을 실행할 경우
그러나,이 결과를 가지고
ARRA [0]과 배열 [2] 객체 및 배열 [1] 문자열이다Array[3]
.
어떻게 가능합니까? 또한 실험 장식자를 사용하여 타이프 스크립트를 어떻게 적절하게 컴파일해야합니까?
내 생각에 ...