summaryrefslogtreecommitdiff
path: root/cli/tests/ts_decorators_bundle.ts
blob: d67ea4d5f203b7be7bd6cac25df444cb5388d8d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint-disable */

import { B } from "./subdir/more_decorators.ts";

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();
new B().method();