2020-11-03 10:19:29 -05:00
|
|
|
// deno-lint-ignore-file
|
2020-10-30 07:19:49 -04:00
|
|
|
|
2020-11-02 06:33:43 -05:00
|
|
|
import { B } from "./subdir/more_decorators.ts";
|
|
|
|
|
2020-10-30 07:19:49 -04:00
|
|
|
function Decorator() {
|
|
|
|
return function (
|
|
|
|
target: Record<string, any>,
|
|
|
|
propertyKey: string,
|
|
|
|
descriptor: TypedPropertyDescriptor<any>,
|
|
|
|
) {
|
|
|
|
const originalFn: Function = descriptor.value as Function;
|
|
|
|
descriptor.value = async function (...args: any[]) {
|
|
|
|
return await originalFn.apply(this, args);
|
|
|
|
};
|
|
|
|
return descriptor;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class SomeClass {
|
|
|
|
@Decorator()
|
|
|
|
async test(): Promise<void> {}
|
|
|
|
}
|
|
|
|
|
|
|
|
new SomeClass().test();
|
2020-11-02 06:33:43 -05:00
|
|
|
new B().method();
|