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

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();