or the source code:
`// @experimentalDecorators
function LogMethod(
target: any,
propertyKey: string | symbol,
descriptor: PropertyDescriptor
) {
console.log(target);
console.log(propertyKey);
console.log(descriptor);
}
class Demo {
@LogMethod
public static foo(bar: number) {
// do nothing
}
@LogMethod
public foo2(bar: number) {
// do nothing
}
}
const demo = new Demo();
Demo.foo(10);
demo.foo2(12);`
The output of js with something like __decorate(([...], Demo.prototype, "foo2", null)
but the karma-typescript output code like __decorate([LogMethod], Demo.prototype, 'foo2')
the missing null at end will make the code in __decorate as following:
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc
make the desc keep the undefined value because undefined === null is false.
Please see bellow pictures about the output.
The is the output in TypeScript Playground
Please try with the code in TypeScript Playground
or the source code: `// @experimentalDecorators function LogMethod( target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor ) { console.log(target); console.log(propertyKey); console.log(descriptor); }
class Demo { @LogMethod public static foo(bar: number) { // do nothing }
@LogMethod public foo2(bar: number) { // do nothing } }
const demo = new Demo(); Demo.foo(10); demo.foo2(12);`
The output of js with something like
__decorate(([...], Demo.prototype, "foo2", null)
but the karma-typescript output code like__decorate([LogMethod], Demo.prototype, 'foo2')
the missing null at end will make the code in __decorate as following:
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc
make the desc keep the undefined value because undefined === null is false.Please see bellow pictures about the output. The is the output in TypeScript Playground![typescript](https://user-images.githubusercontent.com/16249180/156743429-c0adff7a-7e70-46e1-9d9e-8055ee979e8d.png)
And the output of karma![karma](https://user-images.githubusercontent.com/16249180/156743437-aa67174a-51bd-42f1-a56c-695510cbae4c.png)